]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-112535: Update _Py_ThreadId() to support s390/s390x (gh-112751)
authorDonghee Na <donghee.na@python.org>
Fri, 8 Dec 2023 14:28:07 +0000 (14:28 +0000)
committerGitHub <noreply@github.com>
Fri, 8 Dec 2023 14:28:07 +0000 (23:28 +0900)
Include/object.h

index 85abd30b5ad7d6ac206ab6464d53114d4cd76e35..bd576b0bd43211cec478edd06584c23abcab357a 100644 (file)
@@ -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