diff --git a/Makefile.uk b/Makefile.uk index 7622bb0..ab77b7c 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -134,7 +134,7 @@ LIBPYTHON3_CORE_CFLAGS-y += $(LIBPYTHON3_SUPRESS_CFLAGS-y) LIBPYTHON3_CORE_CXXFLAGS-y += $(LIBPYTHON3_SUPRESS_CXXFLAGS-y) # Preprocessing symbols -LIBPYTHON3_CORE_DEFINES-y += $(LIBPYTHON3_COMMON_DEFINES-y) -DPy_BUILD_CORE -DPy_BUILD_CORE_BUILTIN +LIBPYTHON3_CORE_DEFINES-y += $(LIBPYTHON3_COMMON_DEFINES-y) -DPy_BUILD_CORE -DPy_BUILD_CORE_BUILTIN -DWORKAROUND_PTHREAD_EMBEDDED LIBPYTHON3_CORE_CFLAGS-y += $(LIBPYTHON3_CORE_DEFINES-y) LIBPYTHON3_CORE_CXXFLAGS-y += $(LIBPYTHON3_CORE_DEFINES-y) diff --git a/patches/0005_workaround_pthread_embedded.patch b/patches/0005_workaround_pthread_embedded.patch new file mode 100644 index 0000000..ea983f3 --- /dev/null +++ b/patches/0005_workaround_pthread_embedded.patch @@ -0,0 +1,44 @@ +From fe7c24ccde424aa21d20a6da3546e8a447dd85d7 Mon Sep 17 00:00:00 2001 +From: Salar Samani +Date: Tue, 29 Jul 2025 02:14:48 +0200 +Subject: [PATCH] workaround pthread_embedded pthread_t type + +--- + Python/thread_pthread.h | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h +index 35b9810aa37..a7976837ae4 100644 +--- a/Python/thread_pthread.h ++++ b/Python/thread_pthread.h +@@ -325,6 +325,19 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) + - The cast to unsigned long is inherently unsafe. + - It is not clear that the 'volatile' (for AIX?) are any longer necessary. + */ ++#ifdef WORKAROUND_PTHREAD_EMBEDDED ++unsigned long ++PyThread_get_thread_ident(void) ++{ ++ volatile pthread_t threadid; ++ uintptr_t tid; ++ if (!initialized) ++ PyThread_init_thread(); ++ threadid = pthread_self(); ++ memcpy(&tid, &threadid, sizeof(tid)); ++ return (unsigned long) tid; ++} ++#else + unsigned long + PyThread_get_thread_ident(void) + { +@@ -334,6 +347,7 @@ PyThread_get_thread_ident(void) + threadid = pthread_self(); + return (unsigned long) threadid; + } ++#endif /*WORKAROUND_PTHREAD_EMBEDDED*/ + + #ifdef PY_HAVE_THREAD_NATIVE_ID + unsigned long +-- +2.43.0 +