Fix crash accessing PyEval_GetFrame from Python's crash handler
Check the thread-state before accessing PyEval_GetFrame, since this is a crash handler, the state of the Python interpreter isn't known.
This commit is contained in:
@@ -585,6 +585,11 @@ void BPY_python_use_system_env(void)
|
||||
void BPY_python_backtrace(FILE *fp)
|
||||
{
|
||||
fputs("\n# Python backtrace\n", fp);
|
||||
|
||||
/* Can happen in rare cases. */
|
||||
if (!_PyThreadState_UncheckedGet()) {
|
||||
return;
|
||||
}
|
||||
PyFrameObject *frame;
|
||||
if (!(frame = PyEval_GetFrame())) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user