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

2019-11-13 Thread Ronald Oussoren
Ronald Oussoren added the comment: You only have to check, using a public API, if you have no control over when C++ objects are destructed. I'd personally try to structure code to make sure that C++ objects owning references to Python objects get destructed before the interpreter is

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

2019-11-13 Thread ysnt27
ysnt27 added the comment: Thanks for making the issue clear. My understanding is that, all C++ destructors have to check Python interpreter before Py_DECREF, like this. ``` cplusplus ~something() { // PyThreadState *_tstate = PyThreadState_GET(); PyThreadState *_tstate =

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

2019-11-05 Thread Ronald Oussoren
Ronald Oussoren 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

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

2019-10-27 Thread ysnt27
New submission from ysnt27 : My original issue was reported to Boost.Python, https://github.com/boostorg/python/issues/248 And I found similar issue https://bugs.python.org/issue17703 It seems root cause exists in Python not Boost.Python. As the issue #17703 is already closed, I want to open a