https://github.com/python/cpython/pull/137927 --- Python-3.14.2/Include/pythread.h.orig +++ Python-3.14.2/Include/pythread.h @@ -42,7 +42,8 @@ #if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \ || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ || defined(__OpenBSD__) || defined(__NetBSD__) \ - || defined(__DragonFly__) || defined(_AIX)) + || defined(__DragonFly__) || defined(_AIX) \ + || (defined(__sun__) && SIZEOF_LONG >= 8)) #define PY_HAVE_THREAD_NATIVE_ID PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void); #endif --- Python-3.14.2/Python/thread_pthread.h.orig +++ Python-3.14.2/Python/thread_pthread.h @@ -30,6 +30,8 @@ # include /* _lwp_self() */ #elif defined(__DragonFly__) # include /* lwp_gettid() */ +#elif defined(__sun__) && SIZEOF_LONG >= 8 +# include #endif /* The POSIX spec requires that use of pthread_attr_setstacksize @@ -409,6 +411,8 @@ #elif defined(__DragonFly__) lwpid_t native_id; native_id = lwp_gettid(); +#elif defined(__sun__) && SIZEOF_LONG >= 8 + unsigned long native_id = (unsigned long)getpid() << 32 | thr_self(); #endif return (unsigned long) native_id; }