mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator expression in function calls (GH-28576)
(cherry picked from commit e5f13ce5b4
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
fae2694bea
commit
9e209d48ca
5 changed files with 31 additions and 8 deletions
|
@ -833,7 +833,7 @@ invalid_arguments:
|
|||
RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, comprehension_ty)->target, "Generator expression must be parenthesized") }
|
||||
| a=NAME b='=' expression for_if_clauses {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")}
|
||||
| a=args for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a) }
|
||||
| a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }
|
||||
| args ',' a=expression b=for_if_clauses {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, asdl_seq_GET(b, b->size-1)->target, "Generator expression must be parenthesized") }
|
||||
| a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue