This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: lookup extensions with the stable ABI under a platform specific name
Type: enhancement Stage:
Components: Extension Modules Versions: Python 3.11, Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, doko, petr.viktorin
Priority: normal Keywords: patch

Created on 2021-05-25 11:10 by doko, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
platform-stable-abi.diff doko, 2021-05-25 11:10
Messages (3)
msg394325 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2021-05-25 11:10
On Posix targets, the file names for extensionsions are currently

foo.cpython-39-x86_64-linux-gnu.so
foo.abi3.so

for platforms which have PLATFORM_TRIPLET defined.  This makes it clear which extension belongs to which interpreter, and at least on Debian and Ubuntu, it allowes cross-building of extensions by installing both the required build and host (or host and target) packages in the same environment.

Of course, the stable ABI is stable, so introducing another extension suffix to lookup has to be optional.  Having such a lookup only as a local patch in a CPython build would make these extensions not loadable by other CPython builds.

Proposing to also look up an extension with the stable ABI as

foo.x86_64-linux-gnu.abi3.so

Not using foo.x86_64-linux-gnu-abi3.so (with a dash) to keep possible .endswith() matches working.

Adding this new lookup to _PyImport_DynLoadFiletab, before or after the original .abi3.so should be possible.

- Adding it after the original one has the advantage that lookups won't get penalized with one extra lookup for people not using it.
- Adding it before the original one has the advantage that the more specific one is looked up before the more general one. That behavior could also become the default on Debian builds using a local patch.

One more question would be how to document that change, or if the platform specific extension file name should be the preferred name for the future.  Adding here just a minimal patch for discussion.
msg394331 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-05-25 11:41
How will these filenames be generated? Won't build tools like setuptools need to be changed as well?
msg394332 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2021-05-25 11:46
> How will these filenames be generated? Won't build tools like setuptools need to be changed as well?

If the preferred file name stays the same, it would be up to the distro specific packaging tools.  But yes, if the platform specific name would be the preferred one, then it needs documentation and coordination with build tools.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88396
2021-05-25 11:46:20dokosetmessages: + msg394332
2021-05-25 11:41:03petr.viktorinsetmessages: + msg394331
2021-05-25 11:10:17dokocreate