-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
bpo-32377: improve __del__ docs and fix mention about resurrection #4927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| It is possible (though not recommended!) for the :meth:`__del__` method | ||
| to postpone destruction of the instance by creating a new reference to | ||
| it. This is called object *resurrection*. It is implementation-dependent | ||
| whether :meth:`__del__` is called a second time when a resurrected object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the phrase starting with "It is implementation-dependent..." possibly be reworded to more directly reflect common implementations and the caveat this brings?
Something like:
":meth:__del__ is generally only called once for a resurrected object (though this is implementation-dependent), so it may only be possible to resurrect an instance once using :meth:__del__."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I've added a mention that CPython only calls __del__ once.
|
Thanks @pitrou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6. |
…ythonGH-4927) * Fix pythonGH-32377: improve __del__ docs and fix mention about resurrection * Mention that CPython only calls __del__ once. (cherry picked from commit 4b96593)
|
GH-4929 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue32377