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 <ideasman42@gmail.com>2014-02-12 23:53:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-12 23:58:06 +0400
commita397009181c8fa76501f09029d7f308e4961df51 (patch)
treeb18e35edddad2aaf1e5ef23c7c291c438f884777 /source/blender/python/intern/bpy_interface.c
parent70905a6e02a05b650acfb894265b3a2d201f193b (diff)
Fix T38541: sys.exit fails when blender is built as a py-module
Diffstat (limited to 'source/blender/python/intern/bpy_interface.c')
-rw-r--r--source/blender/python/intern/bpy_interface.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index aafb5e3d642..a547604cdd6 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -361,8 +361,10 @@ void BPY_python_start(int argc, const char **argv)
void BPY_python_end(void)
{
// fprintf(stderr, "Ending Python!\n");
+ PyGILState_STATE gilstate;
- PyGILState_Ensure(); /* finalizing, no need to grab the state */
+ /* finalizing, no need to grab the state, except when we are a module */
+ gilstate = PyGILState_Ensure();
/* free other python data. */
pyrna_free_types();
@@ -373,10 +375,12 @@ void BPY_python_end(void)
#ifndef WITH_PYTHON_MODULE
BPY_atexit_unregister(); /* without this we get recursive calls to WM_exit */
-#endif
Py_Finalize();
-
+#else
+ PyGILState_Release(gilstate);
+#endif
+
#ifdef TIME_PY_RUN
/* measure time since py started */
bpy_timer = PIL_check_seconds_timer() - bpy_timer;