diff options
Diffstat (limited to 'Include/pystate.h')
-rw-r--r-- | Include/pystate.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/Include/pystate.h b/Include/pystate.h index a2fd803..6000b81 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -177,20 +177,13 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *); /* Variable and macro for in-line access to current thread state */ /* Assuming the current thread holds the GIL, this is the - PyThreadState for the current thread. - - Issue #23644: pyatomic.h is incompatible with C++ (yet). Disable - PyThreadState_GET() optimization: declare it as an alias to - PyThreadState_Get(), as done for limited API. */ -#if !defined(Py_LIMITED_API) && !defined(__cplusplus) + PyThreadState for the current thread. */ +#ifdef Py_BUILD_CORE PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; -#endif - -#if defined(Py_DEBUG) || defined(Py_LIMITED_API) || defined(__cplusplus) -#define PyThreadState_GET() PyThreadState_Get() +# define PyThreadState_GET() \ + ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) #else -#define PyThreadState_GET() \ - ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) +# define PyThreadState_GET() PyThreadState_Get() #endif typedef |