Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-08-19 09:20:20 +0300
committerCampbell Barton <campbell@blender.org>2022-08-19 09:23:29 +0300
commit5c9bea25d08ccdcac004d22046d0ca08ad3f462c (patch)
treed19add25318b5c9592f80cb3022cb818fbc61f55 /source/blender/python
parent529f0427fce2245d60eb885518f055209405b016 (diff)
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.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_interface.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 939fa475344..23fc0bcaeda 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -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;