Repository navigation
gh-162308: Check modules with target Python in native builds - #162337
Open
Udit-Agarwal20 wants to merge 1 commit into
Open
Udit-Agarwal20 wants to merge 1 commit into
Udit-Agarwal20 wants to merge 1 commit into
Conversation
Run native extension checks with BUILDPYTHON and preserve cross-build behavior using PYTHON_FOR_BUILD and RUNSHARED_FOR_BUILD. Builds on related prior work in python#162311. Co-authored-by: superajun-wsj <wangshaojun.jeffery@bytedance.com>
Udit-Agarwal20
requested review from
AA-Turner,
JacobCoffee,
StanFromIreland,
corona10,
emmatyping,
erlend-aasland,
ezio-melotti,
hugovk,
itamaro and
webknjaz
as code owners
November 20, 2026 20:42
|
The following commit authors need to sign the Contributor License Agreement: |
itamaro
requested changes
Nov 21, 2026
itamaro
left a comment
Contributor
There was a problem hiding this comment.
could you sign the CLA please, and re-request review after you do?
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
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.
Summary
Fixes #162308.
Native CPython builds configured with
--with-build-pythoncurrently executechecksharedmodsusing the external build interpreter (PYTHON_FOR_BUILD) rather than the newly built target interpreter.When the two interpreters have different built-in extension configurations, this can result in incorrect module validation. In addition, the inherited
_PYTHON_HOST_PLATFORMvariable can cause native builds to skip import checks by incorrectly selecting cross-compilation mode.Changes
MODULE_CHECK_COMMANDinconfigure.acto select the appropriate interpreter and checking mode../$(BUILDPYTHON) -Ewith--no-cross-compiling.$(PYTHON_FOR_BUILD)with--cross-compilingfor cross builds.$(RUNSHARED_FOR_BUILD)to avoid injecting target shared-library paths into the build interpreter during cross-compilation._bisectconfigurations.Testing
The following local checks were reported successful:
test_tools.test_makefilein a native build.test_sysconfigandtest_build_detailsin a standard native build.Tools/patchcheck/patchcheck.py.git diff --check._bisectas a built-in.Full cross-architecture build execution and official containerized Autoconf regeneration were not completed locally. These require further CI verification.
Related work and attribution
Builds on the approach proposed in #162311 by @superajun-wsj, with additional regression coverage and preservation of
RUNSHARED_FOR_BUILDfor cross-build safety.Related: #161530.
The original contributor is credited through the commit's
Co-authored-bytrailer. Any outstanding CLA requirements will need to be resolved.AI assistance
This contribution was developed with assistance from Google Antigravity. The changes were reviewed and tested locally, with remaining validation limitations described above.