Skip to content

Conversation

@pitrou
Copy link
Member

@pitrou pitrou commented Dec 19, 2017

@pitrou pitrou changed the title Fix #32377: improve __del__ docs and fix mention about resurrection Issue #32377: improve __del__ docs and fix mention about resurrection Dec 19, 2017
@pitrou pitrou changed the title Issue #32377: improve __del__ docs and fix mention about resurrection bpo-32377: improve __del__ docs and fix mention about resurrection Dec 19, 2017
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
Copy link

@EricCousineau-TRI EricCousineau-TRI Dec 19, 2017

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__."

Copy link
Member Author

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.

@pitrou pitrou merged commit 4b96593 into python:master Dec 19, 2017
@miss-islington
Copy link
Contributor

Thanks @pitrou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@pitrou pitrou deleted the improve_del_docs branch December 19, 2017 18:48
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 19, 2017
…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)
@bedevere-bot
Copy link

GH-4929 is a backport of this pull request to the 3.6 branch.

pitrou pushed a commit that referenced this pull request Dec 19, 2017
…H-4927) (#4929)

* Fix GH-32377: improve __del__ docs and fix mention about resurrection

* Mention that CPython only calls __del__ once.
(cherry picked from commit 4b96593)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants