Skip to content

Commit 31368a4

Browse files
authored
bpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239)
Add pyatomic.h to the VS project (it wasn't referenced).
1 parent 9204fb8 commit 31368a4

File tree

10 files changed

+23
-10
lines changed

10 files changed

+23
-10
lines changed

Include/Python.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
#include "pyport.h"
5454
#include "pymacro.h"
5555

56-
#include "pyatomic.h"
57-
5856
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
5957
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
6058
*/

Include/internal/ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
extern "C" {
55
#endif
66

7-
#include "pyatomic.h"
7+
#include "internal/pyatomic.h"
88
#include "pythread.h"
99

1010
struct _pending_calls {

Include/internal/gil.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
extern "C" {
55
#endif
66

7-
#include "pyatomic.h"
8-
97
#include "internal/condvar.h"
8+
#include "internal/pyatomic.h"
9+
1010
#ifndef Py_HAVE_CONDVAR
11-
#error You need either a POSIX-compatible or a Windows system!
11+
# error You need either a POSIX-compatible or a Windows system!
1212
#endif
1313

1414
/* Enable if you want to force the switching of threads at least

Include/pyatomic.h renamed to Include/internal/pyatomic.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#ifndef Py_ATOMIC_H
22
#define Py_ATOMIC_H
3-
#ifdef Py_BUILD_CORE
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#ifndef Py_BUILD_CORE
8+
# error "Py_BUILD_CORE must be defined to include this header"
9+
#endif
410

511
#include "dynamic_annotations.h"
612

@@ -531,5 +537,8 @@ typedef struct _Py_atomic_int {
531537
_Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_relaxed)
532538
#define _Py_atomic_load_relaxed(ATOMIC_VAL) \
533539
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed)
534-
#endif /* Py_BUILD_CORE */
540+
541+
#ifdef __cplusplus
542+
}
543+
#endif
535544
#endif /* Py_ATOMIC_H */

Include/internal/pystate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ extern "C" {
55
#endif
66

77
#include "pystate.h"
8-
#include "pyatomic.h"
98
#include "pythread.h"
109

1110
#include "internal/mem.h"

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,6 @@ PYTHON_HEADERS= \
988988
$(srcdir)/Include/pgen.h \
989989
$(srcdir)/Include/pgenheaders.h \
990990
$(srcdir)/Include/pyarena.h \
991-
$(srcdir)/Include/pyatomic.h \
992991
$(srcdir)/Include/pycapsule.h \
993992
$(srcdir)/Include/pyctype.h \
994993
$(srcdir)/Include/pydebug.h \
@@ -1029,6 +1028,7 @@ PYTHON_HEADERS= \
10291028
$(srcdir)/Include/internal/ceval.h \
10301029
$(srcdir)/Include/internal/gil.h \
10311030
$(srcdir)/Include/internal/mem.h \
1031+
$(srcdir)/Include/internal/pyatomic.h \
10321032
$(srcdir)/Include/internal/pygetopt.h \
10331033
$(srcdir)/Include/internal/pystate.h \
10341034
$(srcdir)/Include/internal/context.h \

Modules/signalmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
/* XXX Signals should be recorded per thread, now we have thread state. */
55

66
#include "Python.h"
7+
#include "internal/pyatomic.h"
8+
79
#ifndef MS_WINDOWS
810
#include "posixmodule.h"
911
#endif

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<ClInclude Include="..\Include\internal\gil.h" />
119119
<ClInclude Include="..\Include\internal\hamt.h" />
120120
<ClInclude Include="..\Include\internal\mem.h" />
121+
<ClInclude Include="..\Include\internal\pyatomic.h" />
121122
<ClInclude Include="..\Include\internal\pystate.h" />
122123
<ClInclude Include="..\Include\internal\warnings.h" />
123124
<ClInclude Include="..\Include\intrcheck.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
<ClInclude Include="..\Include\internal\mem.h">
154154
<Filter>Include</Filter>
155155
</ClInclude>
156+
<ClInclude Include="..\Include\internal\pyatomic.h">
157+
<Filter>Include</Filter>
158+
</ClInclude>
156159
<ClInclude Include="..\Include\internal\pystate.h">
157160
<Filter>Include</Filter>
158161
</ClInclude>

Python/ceval_gil.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <stdlib.h>
66
#include <errno.h>
77

8+
#include "internal/pyatomic.h"
89

910
/* First some general settings */
1011

0 commit comments

Comments
 (0)