[Bf-blender-cvs] [4aad17c] master: Use PyThreadState_GetDict, avoid Python internals
Campbell Barton
noreply at git.blender.org
Sat Sep 26 04:09:40 CEST 2015
Commit: 4aad17c622dae537e9d59fee7ee95c211d596b34
Author: Campbell Barton
Date: Sat Sep 26 11:58:31 2015 +1000
Branches: master
https://developer.blender.org/rB4aad17c622dae537e9d59fee7ee95c211d596b34
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 78be5e5..e833dba 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -29,12 +29,6 @@
* BLI_string_utf8() for unicode conversion.
*/
-/* TODO, resolve linking errors on win32 */
-#ifndef _WIN32
-/* needed for Py3.6+ to access Py_PyThreadState_Current */
-#define Py_BUILD_CORE
-#endif
-
#include <Python.h>
#include <frameobject.h>
@@ -671,8 +665,8 @@ void PyC_SetHomePath(const char *py_path_bundle)
bool PyC_IsInterpreterActive(void)
{
- /* expanded PyThreadState_GET which won't throw an exception */
- 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