[issue21351] refcounts not respected at process exit

Tim Peters report at bugs.python.org
Thu May 1 02:17:29 CEST 2014


Tim Peters added the comment:

There's no way to influence finalization order for objects in cycles, and there never was.  So nothing actually changed in that respect ;-)  What did change is that Python used to forcibly break many module-level cycles in a way that just happened to result in the finalization order you wanted.

Outside of cycles it's still as predictable as before.  For example, you could reliably get the finalization order you want by replacing the last two lines with

p.child()
p.child()

Then the children aren't in cycles, and will be finalized first.  But that's still due to other CPython implementation details (which haven't yet changed), not to language guarantees.

But an atexit handler sounds like a saner way to proceed :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21351>
_______________________________________


More information about the Python-bugs-list mailing list