diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-26 04:58:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-26 05:02:17 +0300 |
commit | 4aad17c622dae537e9d59fee7ee95c211d596b34 (patch) | |
tree | 1f63377ee9d720ffe2937077a666272f490f1e86 /source/blender/python | |
parent | 02b789642310f55845ef4e7facc7c2659815bb25 (diff) |
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
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 78be5e558db..e833dba04c8 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 |