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:
parent
529f0427fc
commit
5c9bea25d0
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue