-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpython-3.8.0-c++atomics.patch
More file actions
81 lines (77 loc) · 3 KB
/
Copy pathpython-3.8.0-c++atomics.patch
File metadata and controls
81 lines (77 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
diff -up Python-3.11.0a5/Include/cpython/pyatomic_std.h.6~ Python-3.11.0a5/Include/cpython/pyatomic_std.h
--- Python-3.11.0a5/Include/cpython/pyatomic_std.h.6~ 2022-02-03 19:37:08.000000000 +0100
+++ Python-3.11.0a5/Include/cpython/pyatomic_std.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 <atomic>
+typedef std::atomic<uintptr_t> atomic_uintptr_t;
+typedef std::atomic<int> 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 <stdatomic.h>
#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