You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Different error triggered for soft keyword prefixes #130077
In the grammar file, a soft keyword being the start of an expression makes it fail the path where the error message has this appended: "Perhaps you forgot a comma?"
However, it also apparently does the same thing for any identifer that is a prefix of any soft keyword.
>>> # multi-letter cases
>>> # fine, expected behavior
>>> (test x)
File "<stdin>", line 1
(test x)
^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
>>> (match_ x)
File "<stdin>", line 1
(match_ x)
^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
>>> (match x)
File "<stdin>", line 1
(match x)
^
SyntaxError: invalid syntax
>>> # unexpected behavior
>>> (ma x)
File "<stdin>", line 1
(ma x)
^
SyntaxError: invalid syntax
>>> # single-letter bugs
>>> # expected behavior
>>> (f x)
File "<stdin>", line 1
(f x)
^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
>>> # unexpected behavior
>>> (m x)
File "<stdin>", line 1
(m x)
^
SyntaxError: invalid syntax
Since m is a prefix of match, "forgetting a comma" (i.e. being in a situation that normally triggers that specific error) doesn't provide the same error message as other "normal" identifiers.
Activity
pythongh-130077: Properly match full soft keywords in the parser
pythongh-130077: Properly match full soft keywords in the parser
gh-130077: Properly match full soft keywords in the parser (#135317)
pythongh-130077: Properly match full soft keywords in the parser (pyt…
[3.14] gh-130077: Properly match full soft keywords in the parser (GH…
[3.13] pythongh-130077: Properly match full soft keywords in the pars…
[3.12] pythongh-130077: Properly match full soft keywords in the pars…
pythongh-130077: Properly match full soft keywords in the parser (pyt…
[3.12] gh-130077: Properly match full soft keywords in the parser (GH…
pythongh-130077: Properly match full soft keywords in the parser (pyt…
[3.13] gh-130077: Properly match full soft keywords in the parser (GH…
pythongh-130077: Properly match full soft keywords in the parser (pyt…
pythongh-130077: Properly match full soft keywords in the parser (pyt…