]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add feature macro PY_HAVE_THREAD_NATIVE_ID to the stable ABI definition (GH-32365)
authorPetr Viktorin <encukou@gmail.com>
Fri, 8 Apr 2022 12:35:11 +0000 (14:35 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Apr 2022 12:35:11 +0000 (14:35 +0200)
Doc/data/stable_abi.dat
Lib/test/test_stable_abi_ctypes.py
Misc/NEWS.d/next/C API/2022-04-06-16-29-14.bpo-47169.wVv2bT.rst [new file with mode: 0644]
Misc/stable_abi.txt
Tools/scripts/stable_abi.py

index 7f42f9c12de71584a24c710ef0badd7024b39f6c..849a2cfd51f24aa181812e7d056ba520ce1aebf0 100644 (file)
@@ -625,7 +625,7 @@ function,PyThread_free_lock,3.2,,
 function,PyThread_get_key_value,3.2,,
 function,PyThread_get_stacksize,3.2,,
 function,PyThread_get_thread_ident,3.2,,
-function,PyThread_get_thread_native_id,3.2,,
+function,PyThread_get_thread_native_id,3.2,on platforms with native thread IDs,
 function,PyThread_init_thread,3.2,,
 function,PyThread_release_lock,3.2,,
 function,PyThread_set_key_value,3.2,,
index a49235b81c1b07105b9c70bf7e51c32a00146bd0..efd3b1b7cd2d242d55e365ac5902000b88d2709d 100644 (file)
@@ -615,7 +615,6 @@ SYMBOL_NAMES = (
     "PyThread_get_key_value",
     "PyThread_get_stacksize",
     "PyThread_get_thread_ident",
-    "PyThread_get_thread_native_id",
     "PyThread_init_thread",
     "PyThread_release_lock",
     "PyThread_set_key_value",
diff --git a/Misc/NEWS.d/next/C API/2022-04-06-16-29-14.bpo-47169.wVv2bT.rst b/Misc/NEWS.d/next/C API/2022-04-06-16-29-14.bpo-47169.wVv2bT.rst
new file mode 100644 (file)
index 0000000..66eac05
--- /dev/null
@@ -0,0 +1,2 @@
+:c:func:`PyThread_get_thread_native_id` is excluded from the stable ABI on
+platforms where it doesn't exist (like Solaris).
index 04d22603cc19bd8c7c897c5c69ade354e57c1f27..4864bf319a76f5447a5c9b942f1bb015dc5a24a8 100644 (file)
@@ -1787,6 +1787,7 @@ function PyThread_get_stacksize
 function PyThread_get_thread_ident
     added 3.2
 function PyThread_get_thread_native_id
+    ifdef PY_HAVE_THREAD_NATIVE_ID
     added 3.2
 function PyThread_init_thread
     added 3.2
index feca9a2ba5a4c7b93bc88f246f5c59b1f400103c..9b90e344977f4713fd79b7972b2f43c8dcfaebb3 100755 (executable)
@@ -49,8 +49,17 @@ IFDEF_DOC_NOTES = {
     'MS_WINDOWS': 'on Windows',
     'HAVE_FORK': 'on platforms with fork()',
     'USE_STACKCHECK': 'on platforms with USE_STACKCHECK',
+    'PY_HAVE_THREAD_NATIVE_ID': 'on platforms with native thread IDs',
 }
 
+# To generate the DLL definition, we need to know which feature macros are
+# defined on Windows. On all platforms.
+# Best way to do that is to hardcode the list (and later test in on Windows).
+WINDOWS_IFDEFS = frozenset({
+    'MS_WINDOWS',
+    'PY_HAVE_THREAD_NATIVE_ID',
+})
+
 # The stable ABI manifest (Misc/stable_abi.txt) exists only to fill the
 # following dataclasses.
 # Feel free to change its syntax (and the `parse_manifest` function)
@@ -232,7 +241,7 @@ def gen_python3dll(manifest, args, outfile):
 
     for item in sorted(
             manifest.select(
-                {'function'}, include_abi_only=True, ifdef={'MS_WINDOWS'}),
+                {'function'}, include_abi_only=True, ifdef=WINDOWS_IFDEFS),
             key=sort_key):
         write(f'EXPORT_FUNC({item.name})')
 
@@ -240,7 +249,7 @@ def gen_python3dll(manifest, args, outfile):
 
     for item in sorted(
             manifest.select(
-                {'data'}, include_abi_only=True, ifdef={'MS_WINDOWS'}),
+                {'data'}, include_abi_only=True, ifdef=WINDOWS_IFDEFS),
             key=sort_key):
         write(f'EXPORT_DATA({item.name})')