STINNER Victor added the comment: 2013/11/4 Antoine Pitrou <rep...@bugs.python.org>: > I'm afraid clearing thread states is a bit too brutal. What if some > destructor relies on contents of the thread states (e.g. thread locals)?
When Py_Finalize() is called, only one Python thread hold the GIL. After _Py_Finalizing=tstate is set, no other thread can hold the GIL. If another Python tries to lock the GIL, it is "killed" by PyEval_RestoreThread(). Is that correct? If yes, in which thread would the destructor be called? Would it read Python thread locals without holding the GIL? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19466> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com