Skip to content

gh-140266: Only pass _PYTHON_HOST_PLATFORM when cross compiling - #161530

Draft
itamaro wants to merge 1 commit into
python:mainfrom
itamaro:gh-140266-host-platform-cross-only
Draft

itamaro wants to merge 1 commit into
python:mainfrom
itamaro:gh-140266-host-platform-cross-only

Conversation

@itamaro

@itamaro itamaro commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

configure only sets _PYTHON_HOST_PLATFORM when cross compiling, but PYTHON_FOR_BUILD exported it whenever --with-build-python was given. A native build with a build Python got _PYTHON_HOST_PLATFORM="", which sysconfig.get_platform() returns unchanged, so build-details.json had "platform": "" and the build directory was named build/lib.-3.X.

This passes the variable only when cross compiling.

Tested on macOS with ./configure --with-build-python=... && make build-details.json: platform is macosx-27.2-arm64 and the build directory is named normally.

Written with assistance from Claude Fable 5.1

configure sets _PYTHON_HOST_PLATFORM only for cross builds, but passed it
to the build Python for every --with-build-python build. In a native
build it was empty, so sysconfig.get_platform() returned "" and
build-details.json ended up with "platform": "".

Co-authored-by: Zanie Blue <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
@itamaro
itamaro force-pushed the gh-140266-host-platform-cross-only branch from 4321c38 to c7bf53b Compare November 7, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build The build process and cross-build needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant