Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Lib/test/test_stable_abi_ctypes.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions Misc/stable_abi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions Tools/scripts/stable_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@
'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)
Expand Down Expand Up @@ -232,15 +241,15 @@ def sort_key(item):

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})')

write()

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})')

Expand Down