Match private extension modules against the in-package path only - #2504
Open
LeSingh1 wants to merge 1 commit into
Open
Match private extension modules against the in-package path only#2504LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
check_cython_abi's private-module filter tested `so_path.parts` on the absolute path, so any ancestor directory starting with an underscore made every module look private. That is the normal layout under manylinux (/opt/_internal/cpython-*/) and in GitHub Actions containers (/__w/), where `generate` then writes zero ABI files and exits 0 -- a green run with no coverage at all. `check`'s new-module scan had no filter, while `generate` skipped private modules. Since `generate` never wrote an .abi.json for them, `check` reported every private module as "New module added" on every run and set has_allowed_changes, so it could not print "No changes found" for a package shipping private submodules (cuda.bindings has _bindings/, _internal/, _lib/). Extract the predicate into iter_public_extension_modules() so both paths use it, and match only on the path relative to the package root.
Contributor
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.
Two related defects in
toolshed/check_cython_abi.py's private-module filter.1. The filter matched the absolute path.
generateskipped a module whenany(x.startswith("_") for x in so_path.parts), andso_pathis absolute — so any ancestor directory beginning with an underscore made every module look private. That is the normal layout under manylinux (/opt/_internal/cpython-*/) and in GitHub Actions containers (/__w/):generatethen writes zero.abi.jsonfiles and exits 0 — a green run with no coverage at all.2.
checkhad no filter.generatedeliberately skips private modules as "not part of the public ABI", butcheck's new-module scan globs everything. Sincegeneratenever wrote an.abi.jsonfor them,checkreports every private module asNew module addedon every run and setshas_allowed_changes, so it can never print "No changes found" for a package that ships private submodules —cuda.bindingshas_bindings/,_internal/and_lib/.The fix extracts the predicate into
iter_public_extension_modules(), calls it from both paths, and matches only on the path relative to the package root. Publicdriver.sounder/opt/_internal/...is now kept;_internal/utils.sois still skipped.Verified by reproducing the path defect directly, as above. I deliberately did not add a unit test:
toolshed/README.mdsays these tools "do not warrant CI coverage, unit tests, or the rest of the production-code apparatus", andpytest.ini'stestpathsdoes not includetoolshed/, so a test there would never run. Happy to add one if you would rather have it.Related but not overlapping: #1030 tracks wiring this tool into CI. This fix would be a prerequisite for that to mean anything.
NOTE: developed with the assistance of an AI coding agent. I reviewed and verified the change before submitting.