Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Specialized error messages pegen does not support yet #122
Comments
|
Here are some examples from mypy test cases where we no longer output specialised error messages:
|
|
Yes, that is also an issue with the current |
|
Forgot this above, a fairly minor one since you need to parse with
throws |
|
Oh dear, I tried that, and ast.parse() produces a syntax error that has the entire rest of the file as the text attribute. This gets formatted really weirdly. I just was looking at this code for python#20072, but the problem here is in the ast module and how it interfaces to pegen, not in the formatting of exceptions. UPDATE: It seems to be happening whenever |
|
All the specialised error messages listed here are now supported by the new parser. See among others: python#20076, python#19865, python#20151, python#20153 and python#19911. |
|
Maybe there's an unmerged PR I haven't seen, but it looks like the following doesn't have a specialised error message on CPython master: |
That should be handled by python#20106 |
Here is a probably incomplete list of specialized error messages that are not yet supported by pegen and whose tests have been skipped.
f(x()=2)throwsSyntaxError: expression cannot contain assignment, perhaps you meant "=="?del f()throwsSyntaxError: cannot delete function call(a, "b", c) = (1, 2, 3)throwsSyntaxError: cannot assign to literal. This also included cases, where the invalid target is not the first one is a multiple-assignment statement, i.e.a = True = b.f(L, x for x in L), which throwsSyntaxError: Generator expression must be parenthesized.def f(*): passthrowsSyntaxError: named arguments must follow bare *