Pablo Galindo Salgado <pablog...@gmail.com> added the comment:

I concur, this is not a bug. The contract of the weakref is that the callback 
will be triggered when the object is destroyed, but here the object is not 
destroyed because is owned by the frame in the traceback.

As Mark correctly mentions, the object should die when the try/except/finally 
ends.

I am not sure if it makes sense to document this because this does not really 
relate to weak reference, but why an object is alive. This is by far not the 
only weird way that can keep the object alive and maintain the behaviour so I 
don't know if it makes sense to document this because there are many many other 
confusing scenarios.

For now, I am marking this as "not a bug" but keeping it open in case we want 
to improve the docs.

----------
resolution:  -> not a bug

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45555>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to