Repository navigation
gh-162308: Check native extension modules with the target interpreter - #162311
Closed
superajun-wsj wants to merge 3 commits into
Closed
superajun-wsj wants to merge 3 commits into
superajun-wsj wants to merge 3 commits into
Conversation
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 <contact@zanie.dev> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Select MODULE_CHECK_COMMAND from configure's cross_compiling state. Native builds use the newly built interpreter even when --with-build-python selects an external build Python. Cross builds keep using the build Python. Pass the check mode explicitly so an inherited _PYTHON_HOST_PLATFORM cannot skip native import checks. Use the selected command both when generating missing stdlib information and when reporting extension checks, since both paths check the modules. Exercise differing builtin module configurations in the existing Linux build-Python CI job, and add a Build NEWS entry. Regenerate configure with Autoconf 2.72. Based on PR python#161530 at c7bf53b. Validation: - Native and x86_64-to-AArch64 configure and make all builds passed. - The original recipe reports _bisect import errors twice; the fixed native recipe and inherited-platform check report zero import failures. - test_sysconfig, test_build_details, and test_tools.test_makefile passed (61 tests run, 8 skipped). - Workflow YAML, shell syntax, and git diff --check passed. Co-authored-by: TRAE CLI <traecli@bytedance.com>
Merge b09a7e9 while preserving the prerequisite PR python#161530 and pythongh-162308 fix commits. Resolve the checksharedmods recipe conflict by using RUNSHARED around MODULE_CHECK_COMMAND: native checks run the target interpreter and need its runtime library path. Other upstream RUNSHARED_FOR_BUILD uses remain part of the merged main. Regenerate configure with Autoconf 2.72. Validation on the updated source: - Fresh native host and target builds passed with differing _bisect configurations. The original recipe reproduced both import errors; the fixed recipe and inherited-platform check had zero import failures. - A real x86_64-to-AArch64 configure and make all build passed, with all enabled target modules passing the file checks. - test_sysconfig, test_build_details, and test_tools.test_makefile passed: 68 tests run, 8 skipped. - Updated workflow YAML, shell syntax, and diff whitespace checks passed. Co-authored-by: TRAE CLI <traecli@bytedance.com>
superajun-wsj
requested review from
AA-Turner,
JacobCoffee,
StanFromIreland,
corona10,
emmatyping,
erlend-aasland,
ezio-melotti,
hugovk,
itamaro and
webknjaz
as code owners
November 20, 2026 09:10
|
The following commit authors need to sign the Contributor License Agreement: |
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.
Fixes #162308.
Native builds configured with
--with-build-pythoncurrently run extensionchecks in the external build interpreter. If the target builds
_bisectasa builtin while the build interpreter has it as a shared extension, the
checker reports
_bisect is not a built-in moduleeven though the targetmodule imports successfully.
Select a dedicated module-check command from configure's
cross_compilingstate. Native checks run the newly built target Python; cross checks retain
the external build Python. Pass the mode explicitly to prevent an inherited
_PYTHON_HOST_PLATFORMfrom skipping native imports. Use this command forboth missing-stdlib information generation and the final checks, since both
paths call
ModuleChecker.check().This PR is based on #161530 at
c7bf53b4d659f6838c3f11044034e139cf01f939and includes its prerequisite commitwith the original author and coauthors preserved. #161530 removes the empty
platform marker that previously caused these native builds to skip imports.
The additional fix is commit
51fa2643fffc3fc8ab50ba74e92f464c4fb56327.Current
main(b09a7e92fb0ab958a52ad94e376402cdd3da09b2) is merged so thePR applies cleanly alongside its
RUNSHARED_FOR_BUILDchanges. The selectednative checker uses
RUNSHAREDto load the target interpreter's libraries.Validation:
_bisectin the host and builtin_bisectin the target. The originalrecipe reproduces the import error in both calls; the fixed recipe reports
zero import failures, including with an inherited platform marker.
make allbuild completed using theexternal interpreter. All enabled target modules passed the file checks.
test_sysconfig,test_build_details, andtest_tools.test_makefilepassed:68 tests run, 8 skipped.
and clean application of both commits were verified.
The local native build lacks optional
_decimaland_zstddependencies;the cross sysroot lacks 17 optional module dependencies. These are reported
as missing; all enabled modules have zero import/check failures. The added
GitHub Actions regression job has not yet run on GitHub.
Prepared with assistance from TRAE CLI. The change was checked against the
actual native and cross build paths described above.