Repository navigation
Conversation
The previous implementation of libpython3.so created an empty wrapper library that recorded libpython3.X.so in DT_NEEDED but did not properly re-export symbols. The program with proper Py_LIMITED_API defined cannot actually linked with libpython3.so (-lpython3), and it makes the stable API pointless. And libpython3.so cannot simply be a symbolic link to the libpython3.X.so, since due to the SONAME contains the minor version, error will still be reported during the runtime with a different pythons so version. This fix uses patchelf on Linux to copy the versioned library and set its SONAME to libpython3.so, ensuring binaries get the correct DT_NEEDED entry for stable ABI compatibility. - Add PATCHELF variable detection in configure.ac (Linux only) - Require patchelf on Linux, error if not found - Update libpython3.so target to use patchelf when available - Fall back to original behavior on non-Linux platforms A program linked with the newly patched libpython3.so and stable API, can run with the previous empty wrapper libpython3.so.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
This PR is stale because it has been open for 30 days with no activity. |
shall i do anything ? |
|
This PR is stale because it has been open for 90 days with no activity. |
|
Thanks for the PR, @beeender, and for raising this in gh-104612. Following the DPO discussion, we went with a docs-only change in gh-162498. For Linux embedders that need one binary to work across Python minor versions, the embedding guide now documents how to load This PR would replace the small Given those tradeoffs and the approach we've documented, I'm closing this PR. Thanks again for working on it. |
The previous implementation of libpython3.so created an empty wrapper
library that recorded libpython3.X.so in DT_NEEDED but did not properly
re-export symbols. The program with proper Py_LIMITED_API defined cannot
actually linked with libpython3.so (-lpython3), and it makes the stable
API pointless.
And libpython3.so cannot simply be a symbolic link to the
libpython3.X.so, since due to the SONAME contains the minor version,
error will still be reported during the runtime with a different pythons
so version.
This fix uses patchelf on Linux to copy the versioned library and set
its SONAME to libpython3.so, ensuring binaries get the correct
DT_NEEDED entry for stable ABI compatibility.
A program linked with the newly patched libpython3.so and stable API,
can run with the previous empty wrapper libpython3.so.