diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-17 21:53:27 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-17 21:53:27 (GMT) |
commit | 6562b29e13f4da98558636c43a1b242698c8f8d9 (patch) | |
tree | 7258ee9662971eb81dc9d87489091873b3dcc39a /Include/pystate.h | |
parent | b28de01992fb2f1ab5c210157f719f74d3ea015a (diff) | |
download | cpython-6562b29e13f4da98558636c43a1b242698c8f8d9.zip cpython-6562b29e13f4da98558636c43a1b242698c8f8d9.tar.gz cpython-6562b29e13f4da98558636c43a1b242698c8f8d9.tar.bz2 |
Issue #23644: Fix issues with C++ when compiling Python extensions
Disable completly pyatomic.h on C++, because <stdatomic.h> is not compatible with C++.
<pyatomic.h> is only needed by the optimized PyThreadState_GET() macro in
pystate.h. Instead, declare PyThreadState_GET() as an alias to
PyThreadState_Get(), as done for limited API.
Diffstat (limited to 'Include/pystate.h')
-rw-r--r-- | Include/pystate.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Include/pystate.h b/Include/pystate.h index 4992c22..8539b65 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -174,12 +174,16 @@ 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. */ -#ifndef Py_LIMITED_API + 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) PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; #endif -#if defined(Py_DEBUG) || defined(Py_LIMITED_API) +#if defined(Py_DEBUG) || defined(Py_LIMITED_API) || defined(__cplusplus) #define PyThreadState_GET() PyThreadState_Get() #else #define PyThreadState_GET() \ |