| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 58d9c78 commit 7961bbf
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -873,6 +873,14 @@ Other language changes | |||
| 873 | 873 | imports ``pkg.sub.mod``. | |
| 874 | 874 | (Contributed by Gregory P. Smith in :gh:`83065`.) | |
| 875 | 875 | ||
| 876 | + * File names of Stable ABI extensions that use the ``.so`` suffix may now | ||
| 877 | + include a multiarch tuple, for example, ``foo.abi3-x86-64-linux-gnu.so``. | ||
| 878 | + This permits stable ABI extensions for multiple architectures to be | ||
| 879 | + co-installed into the same directory, without clashing with each | ||
| 880 | + other, as regular dynamic extensions do. | ||
| 881 | + (Contributed by Stefano Rivera in :gh:`122931`.) | ||
| 882 | + | ||
| 883 | + | ||
| 876 | 884 | ||
| 877 | 885 | Default interactive shell | |
| 878 | 886 | ========================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -570,6 +570,7 @@ def collect_sysconfig(info_add): | |||
| 570 | 570 | ||
| 571 | 571 | for name in ( | |
| 572 | 572 | 'ABIFLAGS', | |
| 573 | + 'ALT_SOABI', | ||
| 573 | 574 | 'ANDROID_API_LEVEL', | |
| 574 | 575 | 'CC', | |
| 575 | 576 | 'CCSHARED', | |
@@ -595,6 +596,7 @@ def collect_sysconfig(info_add): | |||
| 595 | 596 | 'Py_REMOTE_DEBUG', | |
| 596 | 597 | 'SHELL', | |
| 597 | 598 | 'SOABI', | |
| 599 | + 'SOABI_PLATFORM', | ||
| 598 | 600 | 'TEST_MODULES', | |
| 599 | 601 | 'VAPTH', | |
| 600 | 602 | 'abs_builddir', | |
@@ -1315,6 +1317,12 @@ def collect_system(info_add): | |||
| 1315 | 1317 | info_add('system.hardware', hardware) | |
| 1316 | 1318 | ||
| 1317 | 1319 | ||
| 1320 | + def collect_importlib(info_add): | ||
| 1321 | + import importlib.machinery | ||
| 1322 | + info_add('importlib.extension_suffixes', | ||
| 1323 | + importlib.machinery.EXTENSION_SUFFIXES) | ||
| 1324 | + | ||
| 1325 | + | ||
| 1318 | 1326 | def collect_info(info): | |
| 1319 | 1327 | error = False | |
| 1320 | 1328 | info_add = info.add | |
@@ -1357,6 +1365,7 @@ def collect_info(info): | |||
| 1357 | 1365 | collect_zstd, | |
| 1358 | 1366 | collect_libregrtest_utils, | |
| 1359 | 1367 | collect_system, | |
| 1368 | + collect_importlib, | ||
| 1360 | 1369 | ||
| 1361 | 1370 | # Collecting from tests should be last as they have side effects. | |
| 1362 | 1371 | collect_test_socket, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | import unittest | |
| 7 | 7 | import sys | |
| 8 | + import sysconfig | ||
| 8 | 9 | ||
| 9 | 10 | ||
| 10 | 11 | class FinderTests(abc.FinderTests): | |
@@ -61,6 +62,7 @@ def test_failure(self): | |||
| 61 | 62 | ||
| 62 | 63 | def test_abi3_extension_suffixes(self): | |
| 63 | 64 | suffixes = self.machinery.EXTENSION_SUFFIXES | |
| 65 | + platform = sysconfig.get_config_var("SOABI_PLATFORM") | ||
| 64 | 66 | if 'win32' in sys.platform: | |
| 65 | 67 | # Either "_d.pyd" or ".pyd" must be in suffixes | |
| 66 | 68 | self.assertTrue({"_d.pyd", ".pyd"}.intersection(suffixes)) | |
@@ -73,6 +75,13 @@ def test_abi3_extension_suffixes(self): | |||
| 73 | 75 | self.assertIn(".abi3.so", suffixes) | |
| 74 | 76 | self.assertIn(".abi3t.so", suffixes) | |
| 75 | 77 | ||
| 78 | + if platform: | ||
| 79 | + if Py_GIL_DISABLED: | ||
| 80 | + self.assertNotIn(f".abi3-{platform}.so", suffixes) | ||
| 81 | + else: | ||
| 82 | + self.assertIn(f".abi3-{platform}.so", suffixes) | ||
| 83 | + self.assertIn(f".abi3t-{platform}.so", suffixes) | ||
| 84 | + | ||
| 76 | 85 | ||
| 77 | 86 | (Frozen_FinderTests, | |
| 78 | 87 | Source_FinderTests | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -457,6 +457,15 @@ def test_soabi(self): | |||
| 457 | 457 | soabi = sysconfig.get_config_var('SOABI') | |
| 458 | 458 | self.assertIn(soabi, _imp.extension_suffixes()[0]) | |
| 459 | 459 | ||
| 460 | + @unittest.skipIf(not _imp.extension_suffixes(), "stub loader has no suffixes") | ||
| 461 | + @unittest.skipIf(sys.platform == "win32", "Does not apply to Windows") | ||
| 462 | + @unittest.skipIf(sysconfig.get_config_var('SOABI_PLATFORM') == 0, | ||
| 463 | + "SOABI_PLATFORM is undefined") | ||
| 464 | + def test_soabi_platform(self): | ||
| 465 | + soabi_platform = sysconfig.get_config_var('SOABI_PLATFORM') | ||
| 466 | + soabi = sysconfig.get_config_var('SOABI') | ||
| 467 | + self.assertIn(soabi_platform, soabi) | ||
| 468 | + | ||
| 460 | 469 | def test_library(self): | |
| 461 | 470 | library = sysconfig.get_config_var('LIBRARY') | |
| 462 | 471 | ldlibrary = sysconfig.get_config_var('LDLIBRARY') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Allow importing stable ABI C extensions that include a multiarch tuple in their filename, e.g. ``foo.abi3-x86-64-linux-gnu.so``. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,8 +46,14 @@ const char *_PyImport_DynLoadFiletab[] = { | |||
| 46 | 46 | "." ALT_SOABI ".so", | |
| 47 | 47 | #endif | |
| 48 | 48 | #ifndef Py_GIL_DISABLED | |
| 49 | + #ifdef SOABI_PLATFORM | ||
| 50 | + ".abi" PYTHON_ABI_STRING "-" SOABI_PLATFORM ".so", | ||
| 51 | + #endif /* SOABI_PLATFORM */ | ||
| 49 | 52 | ".abi" PYTHON_ABI_STRING ".so", | |
| 50 | 53 | #endif /* Py_GIL_DISABLED */ | |
| 54 | + #ifdef SOABI_PLATFORM | ||
| 55 | + ".abi" PYTHON_ABI_STRING "t-" SOABI_PLATFORM ".so", | ||
| 56 | + #endif /* SOABI_PLATFORM */ | ||
| 51 | 57 | ".abi" PYTHON_ABI_STRING "t.so", | |
| 52 | 58 | ".so", | |
| 53 | 59 | #endif /* __CYGWIN__ */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1221,6 +1221,10 @@ AS_CASE([$ac_sys_system], | |||
| 1221 | 1221 | [SOABI_PLATFORM=$PLATFORM_TRIPLET] | |
| 1222 | 1222 | ) | |
| 1223 | 1223 | ||
| 1224 | + if test x$SOABI_PLATFORM != x; then | ||
| 1225 | + AC_DEFINE_UNQUOTED([SOABI_PLATFORM], ["${SOABI_PLATFORM}"], [Platform tag, used in binary module extension filenames.]) | ||
| 1226 | + fi | ||
| 1227 | + | ||
| 1224 | 1228 | if test x$MULTIARCH != x; then | |
| 1225 | 1229 | MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\"" | |
| 1226 | 1230 | fi | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1968,6 +1968,9 @@ | |||
| 1968 | 1968 | /* The size of '_Bool', as computed by sizeof. */ | |
| 1969 | 1969 | #undef SIZEOF__BOOL | |
| 1970 | 1970 | ||
| 1971 | + /* Platform tag, used in binary module extension filenames. */ | ||
| 1972 | + #undef SOABI_PLATFORM | ||
| 1973 | + | ||
| 1971 | 1974 | /* Define to 1 if you have the ANSI C header files. */ | |
| 1972 | 1975 | #undef STDC_HEADERS | |
| 1973 | 1976 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments