Skip to content
Closed
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
10 changes: 10 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ Other language changes
they reference) alive indefinitely.
(Contributed by Łukasz Langa in :gh:`102960`.)

* Stable ABI extensions (with free-threaded compatibility) may now
include a multiarch tuple in the filename, e.g.
``foo.abi3t-x86-64-linux-gnu.so``.
This permits stable ABI extensions for multiple architectures to be
co-installed into the same directory, without clashing with each
other, as regular dynamic extensions do. Build tools will generate
these multiarch tagged filenames, by default, when targeting
compatibility with at least Python 3.15.
(Contributed by Stefano Rivera in :gh:`122931`.)


New modules
===========
Expand Down
9 changes: 9 additions & 0 deletions Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ def collect_sysconfig(info_add):

for name in (
'ABIFLAGS',
'ALT_SOABI',
'ANDROID_API_LEVEL',
'CC',
'CCSHARED',
Expand All @@ -595,6 +596,7 @@ def collect_sysconfig(info_add):
'Py_REMOTE_DEBUG',
'SHELL',
'SOABI',
'SOABI_PLATFORM',
'TEST_MODULES',
'VAPTH',
'abs_builddir',
Expand Down Expand Up @@ -1316,6 +1318,12 @@ def collect_system(info_add):
info_add('system.hardware', hardware)


def collect_importlib(info_add):
import importlib.machinery
info_add('importlib.extension_suffixes',
importlib.machinery.EXTENSION_SUFFIXES)


def collect_info(info):
error = False
info_add = info.add
Expand Down Expand Up @@ -1358,6 +1366,7 @@ def collect_info(info):
collect_zstd,
collect_libregrtest_utils,
collect_system,
collect_importlib,

# Collecting from tests should be last as they have side effects.
collect_test_socket,
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_importlib/extension/test_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import unittest
import sys
import sysconfig


class FinderTests(abc.FinderTests):
Expand Down Expand Up @@ -61,6 +62,7 @@ def test_failure(self):

def test_abi3_extension_suffixes(self):
suffixes = self.machinery.EXTENSION_SUFFIXES
platform = sysconfig.get_config_var("SOABI_PLATFORM")
if 'win32' in sys.platform:
# Either "_d.pyd" or ".pyd" must be in suffixes
self.assertTrue({"_d.pyd", ".pyd"}.intersection(suffixes))
Expand All @@ -71,6 +73,8 @@ def test_abi3_extension_suffixes(self):
self.assertNotIn(".abi3.so", suffixes)
else:
self.assertIn(".abi3.so", suffixes)
if platform:
self.assertIn(f".abi3t-{platform}.so", suffixes)
self.assertIn(".abi3t.so", suffixes)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Linux: Include multiarch tuples in ``abi3t`` stable ABI C extension filenames, e.g. ``foo.abi3t-x86-64-linux-gnu.so``, by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Linux: ": this change doesn't seem to be specific to Linux, is it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those tags won't exist on not-Linux

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should change the text to say on platforms with multiarch tags (e.g. Linux).

3 changes: 3 additions & 0 deletions Python/dynload_shlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const char *_PyImport_DynLoadFiletab[] = {
#ifndef Py_GIL_DISABLED
".abi" PYTHON_ABI_STRING ".so",
#endif /* Py_GIL_DISABLED */
#ifdef SOABI_PLATFORM
".abi" PYTHON_ABI_STRING "t-" SOABI_PLATFORM ".so",
#endif /* SOABI_PLATFORM */
".abi" PYTHON_ABI_STRING "t.so",
".so",
#endif /* __CYGWIN__ */
Expand Down
6 changes: 6 additions & 0 deletions configure

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

4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,10 @@ AS_CASE([$ac_sys_system],
[SOABI_PLATFORM=$PLATFORM_TRIPLET]
)

if test x$SOABI_PLATFORM != x; then
AC_DEFINE_UNQUOTED([SOABI_PLATFORM], ["${SOABI_PLATFORM}"], [Platform tag, used in binary module extension filenames.])
fi

if test x$MULTIARCH != x; then
MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
fi
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,9 @@
/* The size of '_Bool', as computed by sizeof. */
#undef SIZEOF__BOOL

/* Platform tag, used in binary module extension filenames. */
#undef SOABI_PLATFORM

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

Expand Down
Loading