26 lines
934 B
Diff
26 lines
934 B
Diff
The deprecated PyEval_ReleaseLock() triggers a segfault with Python 3.9.0.
|
|
See issue at https://developer.blender.org/T81688 and fix at
|
|
https://developer.blender.org/rB5edba9b42f684bf8b99894bb6988e7f46180e12c
|
|
|
|
--- a/source/blender/python/generic/bpy_threads.c 2020-10-13 15:29:16.708347045 -0400
|
|
+++ b/source/blender/python/generic/bpy_threads.c 2020-10-13 15:29:43.123345331 -0400
|
|
@@ -29,14 +29,11 @@
|
|
/* analogue of PyEval_SaveThread() */
|
|
BPy_ThreadStatePtr BPY_thread_save(void)
|
|
{
|
|
- PyThreadState *tstate = PyThreadState_Swap(NULL);
|
|
- /* note: tstate can be NULL when quitting Blender */
|
|
-
|
|
- if (tstate && PyEval_ThreadsInitialized()) {
|
|
- PyEval_ReleaseLock();
|
|
+ /* The thread-state can be NULL when quitting Blender. */
|
|
+ if (_PyThreadState_UncheckedGet()) {
|
|
+ return (BPy_ThreadStatePtr)PyEval_SaveThread();
|
|
}
|
|
-
|
|
- return (BPy_ThreadStatePtr)tstate;
|
|
+ return NULL;
|
|
}
|
|
|
|
/* analogue of PyEval_RestoreThread() */
|