def _finalize_(self): space = self.space w_func = self.getdictvalue(space, '__del__') if w_func is None: w_func = self.getattr_from_class(space, '__del__') if w_func is not None: if space.user_del_action.gc_disabled(self): return try: space.call_function(w_func) except Exception as e: # report this came from __del__ vs a generic finalizer report_error(space, e, "method __del__ of ", self)
def _finalize_(self): space = self.space w_func = self.getdictvalue(space, '__del__') if w_func is None: w_func = self.getattr_from_class(space, '__del__') if w_func is not None: if space.user_del_action.gc_disabled(self): return try: space.call_function(w_func) except Exception as e: # report this came from __del__ vs a generic finalizer report_error(space, e, "method __del__ of ", self)
def _finalize_(self): """This is called at the end, if enable_callbacks() was invoked. It activates the callbacks. """ if self.other_refs_weak is None: return # # If this is set, then we're in the 'gc.disable()' mode. In that # case, don't invoke the callbacks now. if self.space.user_del_action.gc_disabled(self): return # items = self.other_refs_weak.items() self.other_refs_weak = None for i in range(len(items)-1, -1, -1): w_ref = items[i]() if w_ref is not None and w_ref.w_callable is not None: try: w_ref.activate_callback() except Exception as e: report_error(self.space, e, "weakref callback ", w_ref.w_callable)
def _finalize_(self): """This is called at the end, if enable_callbacks() was invoked. It activates the callbacks. """ if self.other_refs_weak is None: return # # If this is set, then we're in the 'gc.disable()' mode. In that # case, don't invoke the callbacks now. if self.space.user_del_action.gc_disabled(self): return # items = self.other_refs_weak.items() self.other_refs_weak = None for i in range(len(items)-1, -1, -1): w_ref = items[i]() if w_ref is not None and w_ref.w_callable is not None: try: w_ref.activate_callback() except Exception as e: report_error(self.space, e, "weakref callback ", w_ref.w_callable)