diff -up Python-3.11.0a5/Include/internal/pycore_atomic.h.6~ Python-3.11.0a5/Include/internal/pycore_atomic.h --- Python-3.11.0a5/Include/internal/pycore_atomic.h.6~ 2022-02-03 19:37:08.000000000 +0100 +++ Python-3.11.0a5/Include/internal/pycore_atomic.h 2022-02-08 17:49:48.488052459 +0100 @@ -1,5 +1,18 @@ #ifndef Py_ATOMIC_H #define Py_ATOMIC_H + +#if defined(__cplusplus) && !defined(NO_CXX_ATOMICS) +#include +typedef std::atomic atomic_uintptr_t; +typedef std::atomic atomic_int; +#define memory_order_relaxed std::memory_order_relaxed +#define memory_order_acquire std::memory_order_acquire +#define memory_order_release std::memory_order_release +#define memory_order_acq_rel std::memory_order_acq_rel +#define memory_order_seq_cst std::memory_order_seq_cst +#define CXX_ATOMICS 1 +#endif + #ifdef __cplusplus extern "C" { #endif @@ -11,7 +24,7 @@ extern "C" { #include "dynamic_annotations.h" /* _Py_ANNOTATE_MEMORY_ORDER */ #include "pyconfig.h" -#ifdef HAVE_STD_ATOMIC +#if defined(HAVE_STD_ATOMIC) && !defined(CXX_ATOMICS) # include #endif diff -up Python-3.11.0a5/Include/internal/pycore_gil.h.6~ Python-3.11.0a5/Include/internal/pycore_gil.h --- Python-3.11.0a5/Include/internal/pycore_gil.h.6~ 2022-02-03 19:37:08.000000000 +0100 +++ Python-3.11.0a5/Include/internal/pycore_gil.h 2022-02-08 17:49:06.774200895 +0100 @@ -1,5 +1,8 @@ #ifndef Py_INTERNAL_GIL_H #define Py_INTERNAL_GIL_H + +#include "pycore_atomic.h" /* Intentionally not in extern C */ + #ifdef __cplusplus extern "C" { #endif @@ -8,7 +11,6 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_atomic.h" /* _Py_atomic_address */ #include "pycore_condvar.h" /* PyCOND_T */ #ifndef Py_HAVE_CONDVAR diff -up Python-3.11.0a5/Include/internal/pycore_initconfig.h.6~ Python-3.11.0a5/Include/internal/pycore_initconfig.h --- Python-3.11.0a5/Include/internal/pycore_initconfig.h.6~ 2022-02-03 19:37:08.000000000 +0100 +++ Python-3.11.0a5/Include/internal/pycore_initconfig.h 2022-02-08 17:49:06.774200895 +0100 @@ -1,5 +1,6 @@ #ifndef Py_INTERNAL_CORECONFIG_H #define Py_INTERNAL_CORECONFIG_H + #ifdef __cplusplus extern "C" { #endif diff -up Python-3.11.0a5/Include/internal/pycore_pylifecycle.h.6~ Python-3.11.0a5/Include/internal/pycore_pylifecycle.h --- Python-3.11.0a5/Include/internal/pycore_pylifecycle.h.6~ 2022-02-03 19:37:08.000000000 +0100 +++ Python-3.11.0a5/Include/internal/pycore_pylifecycle.h 2022-02-08 17:49:06.774200895 +0100 @@ -1,5 +1,6 @@ #ifndef Py_INTERNAL_LIFECYCLE_H #define Py_INTERNAL_LIFECYCLE_H + #ifdef __cplusplus extern "C" { #endif diff -up Python-3.11.0a5/Include/internal/pycore_pystate.h.6~ Python-3.11.0a5/Include/internal/pycore_pystate.h --- Python-3.11.0a5/Include/internal/pycore_pystate.h.6~ 2022-02-03 19:37:08.000000000 +0100 +++ Python-3.11.0a5/Include/internal/pycore_pystate.h 2022-02-08 17:49:06.774200895 +0100 @@ -1,5 +1,6 @@ #ifndef Py_INTERNAL_PYSTATE_H #define Py_INTERNAL_PYSTATE_H + #ifdef __cplusplus extern "C" { #endif