Skip to content

Commit 2c70a96

Browse files
Move definition of _Py_thread_local back to pyport.h
2 parents 823f0e8 + bb61072 commit 2c70a96

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

Include/internal/pycore_pystate.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,6 @@ _Py_ThreadCanHandleSignals(PyInterpreterState *interp)
8585
return (_Py_IsMainThread() && _Py_IsMainInterpreter(interp));
8686
}
8787

88-
/* Definition of the _Py_thread_local macro. In reality, this should really be
89-
* in pyport.h, but some extensions define Py_BUILD_CORE after including that.
90-
* So, instead of breaking things, we just put this here for now. */
91-
92-
#ifdef thread_local
93-
# define _Py_thread_local thread_local
94-
#elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
95-
# define _Py_thread_local _Thread_local
96-
#elif defined(_MSC_VER) /* AKA NT_THREADS */
97-
# define _Py_thread_local __declspec(thread)
98-
#elif defined(__GNUC__) /* includes clang */
99-
# define _Py_thread_local __thread
100-
#else
101-
# error "no supported thread-local variable storage classifier"
102-
#endif
103-
10488
/* Variable and static inline functions for in-line access to current thread
10589
and interpreter state */
10690

Include/pyport.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,17 @@ extern "C" {
511511
#ifdef WITH_THREAD
512512
// HAVE_THREAD_LOCAL is just defined here for compatibility's sake
513513
# define HAVE_THREAD_LOCAL 1
514+
# ifdef thread_local
515+
# define _Py_thread_local thread_local
516+
# elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
517+
# define _Py_thread_local _Thread_local
518+
# elif defined(_MSC_VER) /* AKA NT_THREADS */
519+
# define _Py_thread_local __declspec(thread)
520+
# elif defined(__GNUC__) /* includes clang */
521+
# define _Py_thread_local __thread
522+
# else
523+
# error "no supported thread-local variable storage classifier"
524+
# endif
514525
#endif
515526

516527
#if defined(__ANDROID__) || defined(__VXWORKS__)

0 commit comments

Comments
 (0)