-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy path3.2.6-no-native-tls.patch
More file actions
101 lines (91 loc) · 2.67 KB
/
3.2.6-no-native-tls.patch
File metadata and controls
101 lines (91 loc) · 2.67 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff --git Python/thread_pthread.h Python/thread_pthread.h
index de42f1a..a4eab78 100644
--- Python/thread_pthread.h
+++ Python/thread_pthread.h
@@ -601,6 +601,12 @@ _pythread_pthread_set_stacksize(size_t size)
#define THREAD_SET_STACKSIZE(x) _pythread_pthread_set_stacksize(x)
+
+/* Issue #25658: POSIX doesn't require that pthread_key_t is integer.
+ If key type isn't integer, TLS functions are implemented by CPython self.
+*/
+#ifdef PTHREAD_KEY_T_IS_INTEGER
+
#define Py_HAVE_NATIVE_TLS
int
@@ -643,3 +649,5 @@ PyThread_get_key_value(int key)
void
PyThread_ReInitTLS(void)
{}
+
+#endif /* PTHREAD_KEY_T_IS_INTEGER */
diff --git configure configure
index b107bf2..59f80cb 100755
--- configure
+++ configure
@@ -7564,6 +7564,35 @@ _ACEOF
fi
+
+# Issue #25658: POSIX doesn't require that pthread_key_t is integer.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthread_key_t is integer" >&5
+$as_echo_n "checking whether pthread_key_t is integer... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <pthread.h>
+int
+main ()
+{
+pthread_key_t k; k * 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_pthread_key_t_is_integer=yes
+else
+ ac_pthread_key_t_is_integer=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pthread_key_t_is_integer" >&5
+$as_echo "$ac_pthread_key_t_is_integer" >&6; }
+if test "$ac_pthread_key_t_is_integer" = yes ; then
+
+$as_echo "#define PTHREAD_KEY_T_IS_INTEGER 1" >>confdefs.h
+
+fi
CC="$ac_save_cc"
diff --git configure.ac configure.ac
index 0ab4430..89e422a 100644
--- configure.ac
+++ configure.ac
@@ -1610,6 +1610,19 @@ if test "$have_pthread_t" = yes ; then
#endif
])
fi
+
+# Issue #25658: POSIX doesn't require that pthread_key_t is integer.
+AC_MSG_CHECKING(whether pthread_key_t is integer)
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_key_t k; k * 1;]])],
+ [ac_pthread_key_t_is_integer=yes],
+ [ac_pthread_key_t_is_integer=no]
+)
+AC_MSG_RESULT($ac_pthread_key_t_is_integer)
+if test "$ac_pthread_key_t_is_integer" = yes ; then
+ AC_DEFINE(PTHREAD_KEY_T_IS_INTEGER, 1,
+ [Define if pthread_key_t is integer.])
+fi
CC="$ac_save_cc"
AC_SUBST(OTHER_LIBTOOL_OPT)
diff --git pyconfig.h.in pyconfig.h.in
index cf0ea1f..0bd8387 100644
--- pyconfig.h.in
+++ pyconfig.h.in
@@ -973,6 +973,9 @@
/* Define if POSIX semaphores aren't enabled on your system */
#undef POSIX_SEMAPHORES_NOT_ENABLED
+/* Define if pthread_key_t is integer. */
+#undef PTHREAD_KEY_T_IS_INTEGER
+
/* Defined if PTHREAD_SCOPE_SYSTEM supported. */
#undef PTHREAD_SYSTEM_SCHED_SUPPORTED