Skip to content

gh-119696: Find the standard library from the shared library path - #46

Draft
zaniebot wants to merge 1 commit into
zb/relocatable-flag-ii-venvfrom
zb/relocatable-flag-ii-getpath
Draft

zaniebot wants to merge 1 commit into
zb/relocatable-flag-ii-venvfrom
zb/relocatable-flag-ii-getpath

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

A POSIX shared build can fail to find its standard library after relocation when argv[0] does not identify the installation, including when Python is embedded in another executable. The library-based search for an unpacked standard library checks only directly beneath the directory containing libpython, so a usual prefix/lib/libpython layout makes it look for prefix/lib/lib/pythonX.Y.

Search from the directory containing libpython and its parents, as the ZIP-file search already does. Explicit home configuration takes precedence, and virtual-environment detection still uses the invoked executable path.

This addresses the library-layout problem already covered by PBS's runtime-library discovery patch, tracked in astral-sh/python-build-standalone#909. It applies to POSIX shared builds independently of --enable-relocatable. The overlapping draft #13 also changes how the runtime library's filename is obtained in Modules/getpath.c; this change is limited to the standard-library search in Modules/getpath.py.

Stacked on #45.

@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-getpath branch from 3324f9d to 1519ab6 Compare October 22, 2026 05:55
@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-getpath branch from 1519ab6 to 76fc817 Compare October 22, 2026 18:50
@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-getpath branch from 76fc817 to 800914b Compare October 22, 2026 19:04
@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-getpath branch from 800914b to bc44780 Compare October 22, 2026 19:30
@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-getpath branch from bc44780 to 258a701 Compare October 22, 2026 22:19
@zaniebot
zaniebot force-pushed the zb/relocatable-flag-ii-getpath branch from 258a701 to ee2ccb6 Compare October 22, 2026 22:52
@zanieb
zanieb added this pull request to stack #57 October 22, 2026 22:53
@zaniebot
zaniebot removed this pull request from stack #57 October 22, 2026 22:59
@zaniebot
zaniebot added this pull request to stack #58 October 22, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant