[Bf-blender-cvs] [7b9bd5b] master: Recent change for Py3.6 compat caused fatal-error

Campbell Barton noreply at git.blender.org
Mon Sep 21 15:14:54 CEST 2015


Commit: 7b9bd5b54622eaad122973595ee6cea18dcd13a9
Author: Campbell Barton
Date:   Mon Sep 21 23:02:50 2015 +1000
Branches: master
https://developer.blender.org/rB7b9bd5b54622eaad122973595ee6cea18dcd13a9

Recent change for Py3.6 compat caused fatal-error

Revert back to old method, and define Py_BUILD_CORE to expose internals.

===================================================================

M	source/blender/python/generic/py_capi_utils.c

===================================================================

diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index cd86ed2..a721b90 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -29,6 +29,8 @@
  * BLI_string_utf8() for unicode conversion.
  */
 
+/* needed for Py3.6+ to access Py_PyThreadState_Current */
+#define Py_BUILD_CORE
 
 #include <Python.h>
 #include <frameobject.h>
@@ -666,7 +668,8 @@ void PyC_SetHomePath(const char *py_path_bundle)
 
 bool PyC_IsInterpreterActive(void)
 {
-	return (PyThreadState_GET() != NULL);
+	/* expanded PyThreadState_GET which won't throw an exception */
+	return (((PyThreadState *)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL);
 }
 
 /* Would be nice if python had this built in




More information about the Bf-blender-cvs mailing list