[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13848] trunk/blender/source/blender/ python/BPY_interface.c: == PyNodes ==

Willian Padovani Germano wpgermano at gmail.com
Sun Feb 24 17:19:39 CET 2008


Revision: 13848
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13848
Author:   ianwill
Date:     2008-02-24 17:19:39 +0100 (Sun, 24 Feb 2008)

Log Message:
-----------
== PyNodes ==

Small update to where a PyGILState_Ensure() call is made.

--

Let me use this commit to mention a couple things related to this change to make Python thread-safe in Blender:

1) This page explains the changes: http://wiki.blender.org/index.php/BlenderDev/BPythonAPI/Threads

2) If you experience hangs (deadlocks) when running anything related to Python in Blender, the related part in the code may need a proper Ensure/Release block, as explained in the above link.

>From Joshua (aligorith)'s previous commit to this file:

"* various problems related to gilstate calls being added in strange places (could someone familiar with python double check that they're in the right places now)?"

I checked the two places you fixed, second one is ok, the first one needed to be before the call to create a py dict -- done. Thanks for catching them!

Modified Paths:
--------------
    trunk/blender/source/blender/python/BPY_interface.c

Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c	2008-02-24 16:08:33 UTC (rev 13847)
+++ trunk/blender/source/blender/python/BPY_interface.c	2008-02-24 16:19:39 UTC (rev 13848)
@@ -1771,12 +1771,12 @@
 	if (!con->text) return;
 	if (con->flag & PYCON_SCRIPTERROR) return;
 	
+	gilstate = PyGILState_Ensure();
+	
 	globals = CreateGlobalDictionary();
 	
 	idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
 	
-	gilstate = PyGILState_Ensure();
-	
 	retval = RunPython(con->text, globals);
 
 	if (retval == NULL) {





More information about the Bf-blender-cvs mailing list