Extracted from https://dev.gentoo.org/~grobian/distfiles/python-prefix-gentoo-3.9.6_p1-patches-r0.tar.xz for use in the bootstrap-prefix.sh script. # HG changeset patch # User Fabian Groffen # Date 1629020477 -7200 # Sun Aug 15 11:41:17 2021 +0200 # Node ID 86464afaa887fbf0d067f27cc2bb2266937624ca # Parent 204652442cff1fc29091ff233a1333c016fe7a7c imported patch 07_all_darwin9_pthreadid.patch diff -r 204652442cff -r 86464afaa887 Python/thread_pthread.h --- a/Python/thread_pthread.h Sun Aug 15 11:41:16 2021 +0200 +++ b/Python/thread_pthread.h Sun Aug 15 11:41:17 2021 +0200 @@ -331,7 +331,17 @@ PyThread_get_thread_native_id(void) PyThread_init_thread(); #ifdef __APPLE__ uint64_t native_id; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + native_id = pthread_mach_thread_np(pthread_self()); +#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + if (&pthread_threadid_np) { + (void) pthread_threadid_np(NULL, &native_id); + } else { + native_id = pthread_mach_thread_np(pthread_self()); + } +#else (void) pthread_threadid_np(NULL, &native_id); +#endif #elif defined(__linux__) pid_t native_id; native_id = syscall(SYS_gettid);