Reject non-normalized names in filename parsers - #1359
Open
kocaemre wants to merge 1 commit into
Open
Conversation
Signed-off-by: Emre K <110906681+kocaemre@users.noreply.github.com>
Member
|
I believe the linked issues needs discussion before considering a PR. |
Author
|
Thanks — moved the rationale/options to the linked issue for discussion: #1350 (comment) |
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
NormalizedNameinvariant for parsed wheel and sdist filenames.is_normalized_name.Closes #1350.
Verification
RED:
python3 -m pytest tests/test_utils.py::test_parse_wheel_filename_rejects_names_that_are_not_normalized -qfailed before the fix withFailed: DID NOT RAISE <class 'packaging.utils.InvalidWheelFilename'>.GREEN:
python3 -m pytest tests/test_utils.py -q→ 79 passedpython3 -m pytest -q→ 62425 passed, 427 deselectedpython3 -m ruff check src/packaging/utils.py tests/test_utils.py→ All checks passedpython3 -m ruff format --check src/packaging/utils.py tests/test_utils.py→ 2 files already formattedpython3 -m py_compile src/packaging/utils.py tests/test_utils.pygit diff --checkDuplicate preflight
parse_wheel_filenamecan return a project name that failsis_normalized_name#1350 is open and unassigned.parse_wheel_filenamecan return a project name that failsis_normalized_name#1350, non-ASCII/unicode names,parse_wheel_filename,parse_sdist_filename, andis_normalized_name.parse_wheel_filenamepermits non-normalized versions. #873 and explicitly does not change default parsing or sdist parsing, so this remains a focusedparse_wheel_filenamecan return a project name that failsis_normalized_name#1350 fix.