Tim Peters added the comment: After more thought, I don't think the user can do anything to influence finalization order in cases like this, short of adding "del" statements (or moral equivalents) to break cycles before the interpreter shuts down.
Fine by me ;-) Something CPython could do, when collecting cyclic trash, is pick on objects with the smallest refcount first. That would most often mimic the finalization-order effects of the old bind-module-globals-to-None hack. But it would require more code and more expense to impose a partial order, and would still be an implementation detail specific to CPython (the implementation, as opposed to Python the language). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21351> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com