[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

Ryan Heisler report at bugs.python.org
Sun Jan 17 00:08:41 EST 2021


Ryan Heisler <ryan.a.heisler at gmail.com> added the comment:

Perfect, thanks for your quick response. I was passing a bound method of obj as the func to `weakref.finalize(obj, func, /, *args, **kwargs)`. It slipped my mind that an instance variable like self.name and a bound method like self.clean_up, though they both belong to self, would be evaluated differently.

For anyone wondering, I was looking for weakref.proxy (https://docs.python.org/3/library/weakref.html#weakref.proxy) or weakref.WeakMethod (https://docs.python.org/3/library/weakref.html#weakref.WeakMethod)

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42945>
_______________________________________


More information about the Python-bugs-list mailing list