[issue38609] Trashcan mechanism segfault during interpreter finalization in Python 3.7.5

Ronald Oussoren report at bugs.python.org
Tue Nov 5 16:05:54 EST 2019


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

The attached code creates a static (global) C++ object that owns a reference to a Python object, and releases that reference in its destructor. That destructor runs at program termination, which is after interpreter shutdown (that is after Py_FinalizeEx is called).  

After the call to Py_FinalizeEx() the interpreter no longer exists, and it is unsafe to call Python API functions (other than the ones listed as safe to call before a call to Py_Initialize).  Py_DECREF is not on that safe list.

----------
nosy: +ronaldoussoren

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38609>
_______________________________________


More information about the Python-bugs-list mailing list