Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 258f17c

Browse files
committed
Merge 3.5
2 parents 4298afe + 6df29ad commit 258f17c

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

Include/pyatomic.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/* Issue #23644: <stdatomic.h> is incompatible with C++, see:
2-
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 */
3-
#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
41
#ifndef Py_ATOMIC_H
52
#define Py_ATOMIC_H
3+
#ifdef Py_BUILD_CORE
64

75
#include "dynamic_annotations.h"
86

@@ -248,5 +246,5 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
248246
#define _Py_atomic_load_relaxed(ATOMIC_VAL) \
249247
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed)
250248

249+
#endif /* Py_BUILD_CORE */
251250
#endif /* Py_ATOMIC_H */
252-
#endif /* Py_LIMITED_API */

Include/pystate.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,13 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *);
177177
/* Variable and macro for in-line access to current thread state */
178178

179179
/* Assuming the current thread holds the GIL, this is the
180-
PyThreadState for the current thread.
181-
182-
Issue #23644: pyatomic.h is incompatible with C++ (yet). Disable
183-
PyThreadState_GET() optimization: declare it as an alias to
184-
PyThreadState_Get(), as done for limited API. */
185-
#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
180+
PyThreadState for the current thread. */
181+
#ifdef Py_BUILD_CORE
186182
PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
187-
#endif
188-
189-
#if defined(Py_DEBUG) || defined(Py_LIMITED_API) || defined(__cplusplus)
190-
#define PyThreadState_GET() PyThreadState_Get()
183+
# define PyThreadState_GET() \
184+
((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
191185
#else
192-
#define PyThreadState_GET() \
193-
((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
186+
# define PyThreadState_GET() PyThreadState_Get()
194187
#endif
195188

196189
typedef

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ Release date: TBA
100100
Core and Builtins
101101
-----------------
102102

103+
- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public
104+
Python.h header to fix a compilation error with OpenMP. PyThreadState_GET()
105+
becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies.
106+
103107
Library
104108
-------
105109

0 commit comments

Comments
 (0)