[Bf-blender-cvs] [a3cf9c5] blender-v2.76-release: Use PyThreadState_GetDict, avoid Python internals

Campbell Barton noreply at git.blender.org
Fri Oct 9 14:07:42 CEST 2015


Commit: a3cf9c54d8a000c757a0ee33a399f7a8e2a31120
Author: Campbell Barton
Date:   Fri Oct 9 23:01:22 2015 +1100
Branches: blender-v2.76-release
https://developer.blender.org/rBa3cf9c54d8a000c757a0ee33a399f7a8e2a31120

Use PyThreadState_GetDict, avoid Python internals

Works around problems caused by exposing Py internals (Py_BUILD_CORE).

    Build error with GCC, Py3.6 & OpenMP
    Linking error on MSVC

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

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 9e6ffe9..7343c06 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -666,7 +666,8 @@ void PyC_SetHomePath(const char *py_path_bundle)
 
 bool PyC_IsInterpreterActive(void)
 {
-	return (((PyThreadState *)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL);
+	/* instead of PyThreadState_Get, which calls Py_FatalError */
+	return (PyThreadState_GetDict() != NULL);
 }
 
 /* Would be nice if python had this built in




More information about the Bf-blender-cvs mailing list