diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-21 16:02:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-21 16:08:18 +0300 |
commit | 7b9bd5b54622eaad122973595ee6cea18dcd13a9 (patch) | |
tree | 87f02ee36ae375071517912c5bef410404c19792 | |
parent | df80aeb162ac5def465bb87d95abf851f014f616 (diff) |
Recent change for Py3.6 compat caused fatal-error
Revert back to old method, and define Py_BUILD_CORE to expose internals.
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index cd86ed24bcb..a721b9085a5 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 |