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 finalise
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 = _PyThreadSt
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
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