[issue38609] Trashcan mechanism segfault during interpreter finalization in Python 3.7.5
ysnt27
report at bugs.python.org
Wed Nov 13 22:07:48 EST 2019
ysnt27 <yoshint2012 at gmail.com> 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 = _PyThreadState_UncheckedGet();
if (_tstate) {
Py_DECREF(somelist);
}
}
```
Is this right?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38609>
_______________________________________
More information about the Python-bugs-list
mailing list