Skip to content

Conversation

@di
Copy link
Member

@di di commented Aug 21, 2025

The current regex permits strings that end in the newline character, which is counter to what the description for the field states ("ASCII letters and numbers, period, underscore and hyphen").

This updates the regex to use \Z instead of $ to match at the end of the string and exclude newline characters.

Corresponding update to the spec is here: pypa/packaging.python.org#1898.

The current regex permits strings that end in the newline character, which is counter to what the description for the field states ("ASCII letters and numbers, period, underscore and hyphen").

This updates the rexex to use `\Z` instead of `$` to match at the end of the string and exclude newline characters.
@brettcannon brettcannon merged commit 258202e into pypa:main Aug 21, 2025
38 checks passed
@brettcannon
Copy link
Member

Good catch! I forgot $ matches before a newline even when re.DOTALL isn't used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants