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

2021-01-16 Thread Ryan Heisler
Ryan Heisler 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

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

2021-01-16 Thread Ryan Heisler
New submission from Ryan Heisler : In the documentation for `weakref.finalize` (https://docs.python.org/3.9/library/weakref.html#weakref.finalize), it says: "Note It is important to ensure that func, args and kwargs do not own any references to obj, either directly or indirectly,