Skip to content

Conversation

@notatallshaw
Copy link
Member

@notatallshaw notatallshaw commented Dec 2, 2025

DPO thread: https://discuss.python.org/t/mistakes-in-dependency-specifiers-grammar/105190

If you use the example script with the inserted grammar and use the test name===1 you get the following exception:

ometa.runtime.ParseError: 
name===1
       ^
Parse error at line 1, column 7: expected EOF. trail: [letterOrDigit version version_one version_many versionspec]

This is because if == is listed before === then the first two characters of === are matched against ==. This PR changes === to be listed before ==, after which you get:

name===1 -> ('name', [], [('===', '1')], None)

📚 Documentation preview 📚: https://python-packaging-user-guide--1969.org.readthedocs.build/en/1969/

@notatallshaw
Copy link
Member Author

Oh also this fixes the ordering of <= and < in the version specifier grammar which is incorrect and inconsistent with the ordering listed in the full grammar file.

I copy and pasted the correct ordering from the full grammar file, so I didn't notice this fix until rereading the PR.

Copy link
Member

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging as a bug fix (since any parser that actually worked couldn't have been using the grammar as written)

@ncoghlan ncoghlan added this pull request to the merge queue Dec 4, 2025
Merged via the queue into pypa:main with commit 1b617f8 Dec 4, 2025
7 checks passed
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.

3 participants