summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2023-12-08 14:28:07 (GMT)
committerGitHub <noreply@github.com>2023-12-08 14:28:07 (GMT)
commitc744dbe9ac0e88e395a7464f20a4fd4184a0a222 (patch)
tree7901080fc4de19d7526aa91ace4c72a8af576edb
parente6ac25429fa5034ce7c1f04e34ec705ed6e9f522 (diff)
downloadcpython-c744dbe9ac0e88e395a7464f20a4fd4184a0a222.zip
cpython-c744dbe9ac0e88e395a7464f20a4fd4184a0a222.tar.gz
cpython-c744dbe9ac0e88e395a7464f20a4fd4184a0a222.tar.bz2
gh-112535: Update _Py_ThreadId() to support s390/s390x (gh-112751)
-rw-r--r--Include/object.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h
index 85abd30..bd576b0 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -279,6 +279,10 @@ _Py_ThreadId(void)
__asm__ ("" : "=r" (tp));
tid = tp;
#endif
+#elif defined(__s390__) && defined(__GNUC__)
+ // Both GCC and Clang have supported __builtin_thread_pointer
+ // for s390 from long time ago.
+ tid = (uintptr_t)__builtin_thread_pointer();
#else
# error "define _Py_ThreadId for this platform"
#endif