Skip to content

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

Draft
zaniebot wants to merge 1 commit into
mainfrom
zb/getpath-library-main-20261023
Draft

zaniebot wants to merge 1 commit into
mainfrom
zb/getpath-library-main-20261023

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

An older version of BitBake in Yocto’s Poky distribution launched its server with os.execl(sys.executable, "bitbake-server", ...). With Python installed by uv, the reduced example in astral-sh/python-build-standalone#713 fell back to the compiled-in /install prefix and failed to import encodings. A matching system Python could mask the failure by supplying its own standard library. BitBake changed its launcher in 2023 to pass sys.executable as argv[0]. PBS diagnosis · BitBake launcher fix

On a POSIX shared build with libpython in prefix/lib, the library-based lookup checks prefix/lib/lib/pythonX.Y/os.py and misses prefix/lib/pythonX.Y/os.py. Search the parent directories of an absolute libpython path for the unpacked standard library, as startup already does for the ZIP file. This addresses the shared-build case tracked in astral-sh/python-build-standalone#909.

A loader can report a relative filename, and an embedding application can change directories before initializing Python. Keep the adjacent lookup for relative paths because searching upward from the new working directory could select another installation’s standard library.

@zaniebot
zaniebot force-pushed the zb/getpath-library-main-20261023 branch from 1f9286c to befae08 Compare October 23, 2026 22:50
@zaniebot
zaniebot force-pushed the zb/getpath-library-main-20261023 branch from befae08 to ba6fbd2 Compare October 23, 2026 22:57
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