This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients guijarro, mark.dickinson, nanjekyejoannah, nascheme, pablogsal
Date 2021-10-22.14:52:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634914337.11.0.542228961027.issue45555@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-10-22 14:52:17pablogsalsetrecipients: + pablogsal, nascheme, mark.dickinson, nanjekyejoannah, guijarro
2021-10-22 14:52:17pablogsalsetmessageid: <1634914337.11.0.542228961027.issue45555@roundup.psfhosted.org>
2021-10-22 14:52:17pablogsallinkissue45555 messages
2021-10-22 14:52:17pablogsalcreate