File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,13 @@ def _unpack_self(self, *args):
103103 instance = self ._self_instance and self ._self_instance ()
104104 function = self .__wrapped__ and self .__wrapped__
105105
106+ # If the wrapped function was originally a bound method but the
107+ # instance it was bound to has been garbage collected, raise a
108+ # ReferenceError rather than silently calling it as unbound.
109+
110+ if self ._self_instance is not None and instance is None :
111+ raise ReferenceError ("weakly-referenced object no longer exists" )
112+
106113 # If the wrapped function was originally a bound function, for
107114 # which we retained a reference to the instance and the unbound
108115 # function we need to rebind the function and then call it. If
You can’t perform that action at this time.
0 commit comments