diff -r 4accc35cbfcf Include/pyatomic.h --- a/Include/pyatomic.h Tue Mar 17 10:49:17 2015 +0100 +++ b/Include/pyatomic.h Tue Mar 17 12:22:11 2015 +0100 @@ -1,4 +1,5 @@ -#ifndef Py_LIMITED_API +/* Issue #23644: pyatomic.h is incompatible with C++ */ +#if !defined(Py_LIMITED_API) && !defined(__cplusplus) #ifndef Py_ATOMIC_H #define Py_ATOMIC_H @@ -6,10 +7,6 @@ #include "pyconfig.h" -#ifdef __cplusplus -extern "C" { -#endif - #if defined(HAVE_STD_ATOMIC) #include #endif @@ -250,9 +247,5 @@ static __inline__ void #define _Py_atomic_load_relaxed(ATOMIC_VAL) \ _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed) -#ifdef __cplusplus -} -#endif - #endif /* Py_ATOMIC_H */ #endif /* Py_LIMITED_API */ diff -r 4accc35cbfcf Include/pystate.h --- a/Include/pystate.h Tue Mar 17 10:49:17 2015 +0100 +++ b/Include/pystate.h Tue Mar 17 12:22:11 2015 +0100 @@ -174,12 +174,14 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncEx /* 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++. */ +#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() \