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:
authorSybren A. Stüvel <sybren@blender.org>2021-09-09 12:33:16 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-09-09 15:27:33 +0300
commitda50cd86a745c9e63fc645bad6f0a5412afff920 (patch)
tree281b8304c2118c39cf90552900def85be71e68b9
parentbf47fb40fd6f0ee9386e9936cf213a1049c55b61 (diff)
Cleanup: clarify comment about the use of `_PyThreadState_UncheckedGet()`
No functional changes.
-rw-r--r--source/blender/python/generic/bpy_threads.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/python/generic/bpy_threads.c b/source/blender/python/generic/bpy_threads.c
index bd707f728a1..57eb3a82c44 100644
--- a/source/blender/python/generic/bpy_threads.c
+++ b/source/blender/python/generic/bpy_threads.c
@@ -29,7 +29,9 @@
/* analogue of PyEval_SaveThread() */
BPy_ThreadStatePtr BPY_thread_save(void)
{
- /* The thread-state can be NULL when quitting Blender. */
+ /* Use `_PyThreadState_UncheckedGet()`, instead of more canonical `PyGILState_Check()` or
+ * `PyThreadState_Get()`, to avoid a fatal error issued when a thread state is NULL (the thread
+ * state can be NULL when quitting Blender). */
if (_PyThreadState_UncheckedGet()) {
return (BPy_ThreadStatePtr)PyEval_SaveThread();
}