Repository navigation
Conversation
--enable-relocatable
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PBS rewrites loader paths after installing CPython. On glibc, a wheel that links
libpythonand supplies its ownDT_RUNPATHcan still fail to import.Backport the experimental
--enable-relocatableflag proposed in python/cpython#160377 and implement it for Python 3.14, 3.15, and 3.16. CPython links shared libraries and standard-library extensions with paths relative to their installed locations. Its install rules generate relocatable scripts and embedding metadata, andsysconfigderivesBINDIR,LIBDIR, andLIBPLfrom the running installation.On glibc, the launcher that statically links
libpythonopens the bundled shared library at startup so a wheel can reuse it. On musl, the launcher carries a path to the library directory. Non-framework macOS builds give the dylib its@rpathinstall name at link time.On one x86-64 Linux host with warm filesystem caches, minimal startup without
sitewas 12–22% slower on glibc. The table gives median changes in milliseconds relative to the existing PBS builds. The import columns include startup and loading a C extension linked tolibpython.At startup, the preloaded
libpythonoccupied 3.84–4.28 MiB of resident memory on glibc, including 1.31–1.49 MiB of private dirty pages per process. On musl, the linked import was the first use of the shared library.On Python 3.15.1, a glibc prototype that retried a failed import saved 0.98 ms at startup and added 0.27 ms when a retry was needed. A different
libpythononLD_LIBRARY_PATHcan satisfy the first load and bypass the retry.