Recent change for Py3.6 compat caused fatal-error

Revert back to old method, and define Py_BUILD_CORE to expose internals.
This commit is contained in:
Campbell Barton 2015-09-21 23:02:50 +10:00
parent df80aeb162
commit 7b9bd5b546
1 changed files with 4 additions and 1 deletions

View File

@ -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