bpo-43914: Highlight invalid ranges in SyntaxErrors #25525
Conversation
|
@lysnikolaou Could you take a look so we can get this before feature freeze? Some notes:
|
|
@pablogsal Yup, I'll have a look tomorrow morning. |
|
Really really great work! I've left a couple of comments/questions. |
| RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "Generator expression must be parenthesized") } | ||
| | a=args ',' '*' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable argument unpacking follows keyword argument unpacking") } | ||
| | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] { | ||
| RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, asdl_seq_GET(b, b->size-1)->target, "Generator expression must be parenthesized") } |
pablogsal
Apr 23, 2021
•
Author
Member
Yeah, but it won't be shorter because _PyPegen_seq_last_item is generic and does type erasure so we need to recast to get the target
|
I also have some recommendations for the new error ranges. For example I'd prefer:
over
I guess, it'd be better to merge this and I'll open another PR to discuss these there. Thoughts? |
Yeah, that one is especially tricky because it (not with what you suggest but I have seen it happen) can make the parser advance too much and the error will be reported too far away from the '=' sign. |
Yup, I can see that happening. |
|
Let's go! |
|
Only a nit. |
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
If you want to schedule another build, you need to add the " |
|
If you want to schedule another build, you need to add the " |
a77aac4
into
python:master
|
@pablogsal: Please replace |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

https://bugs.python.org/issue43914