fix: reject invalid interpreter tags - #1351
Merged
Merged
Conversation
Validate interpreter components as identifiers so malformed wheel filenames such as 2.7.6 no longer expand into numeric tags. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the exact validation boundary: interpreter components must be identifiers, while other non-empty tag components remain accepted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
henryiii
approved these changes
Jul 28, 2026
henryiii
left a comment
Contributor
There was a problem hiding this comment.
The PEP said it was an identifier, so I think this is a valid restriction, and will protect against some mistakes.
Contributor
|
Thanks! |
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 #577.
Summary
Tagobjectsplaylyfe-0.1.1-2.7.6-none-any.whl, which previously expanded into the numeric interpreter tags2,7, and6InvalidWheelFilenameCompatibility
The validation uses
str.isidentifier()rather than a fixed implementation allowlist. Existing well-known tags, custom implementation identifiers, uppercase input normalized byTag, and every tag produced bysys_tags()continue to parse. Non-empty ABI and platform components retain their existing behavior.Tests
python -m pytest tests/test_tags.py::TestParseTag tests/test_utils.py -q— 105 passedpython -m pytest -q— 62,399 passed, 1 skipped, 427 deselectedruff-check,ruff-format, and reStructuredText pre-commit hooks — passedpython -m nox -s docs— HTML, LaTeX, and doctest builds passed; 418 doctests passedsys_tags()entries plus custom interpreter identifiers — passednox -s lintalso passed all hooks except the repository's pinned mypy hook on Windows: mypy 2.1 rejects the configured Python 3.9 target and reports the existingos.confstrplatform error in_manylinux.py.