* generalized star expression handling, including double stars; this
fixes multiplication making expressions "unsafe" for trailing commas (#132)
+* fix parsing of complex expressions after star and double stars in
+ function parameters (#2)
+
### 18.4a2
* fixed parsing of unaligned standalone comments (#99, #112)
if not prevp or prevp.type == token.LPAR:
return NO
- elif prev.type == token.EQUAL or prev.type == token.DOUBLESTAR:
+ elif prev.type in {token.EQUAL} | STARS:
return NO
elif p.type == syms.decorator:
and n.children[-1].type == token.COMMA
):
for ch in n.children:
- if ch.type == token.STAR or ch.type == token.DOUBLESTAR:
+ if ch.type in STARS:
return True
return False
# that precede iterable unpackings are blocked; etc.
argument: ( test [comp_for] |
test '=' test |
- '**' expr |
- star_expr )
+ '**' test |
+ '*' test )
comp_iter: comp_for | comp_if
comp_for: [ASYNC] 'for' exprlist 'in' or_test [comp_iter]
]
slice[0]
slice[0:1]
-@@ -121,85 +135,119 @@
+@@ -121,88 +135,122 @@
numpy[-(c + 1):, d]
numpy[:, l[-2]]
numpy[:, ::-1]
async def f():
await some.complicated[0].call(with_args=(True or (1 is not 1)))
+-print(* [] or [1])
++
++
++print(*[] or [1])
+ print(**{1: 3} if False else {x: x for x in range(3)})
+-print(* lambda x: x)
-for x, in (1,), (2,), (3,): ...
-for y in (): ...
-for z in (i for i in (1, 2, 3)): ...
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-):
- return True
-+
-+
++print(*lambda x: x)
+for (x,) in (1,), (2,), (3,):
+ ...
+for y in ():
async def f():
await some.complicated[0].call(with_args=(True or (1 is not 1)))
+print(* [] or [1])
+print(**{1: 3} if False else {x: x for x in range(3)})
+print(* lambda x: x)
for x, in (1,), (2,), (3,): ...
for y in (): ...
for z in (i for i in (1, 2, 3)): ...
await some.complicated[0].call(with_args=(True or (1 is not 1)))
+print(*[] or [1])
+print(**{1: 3} if False else {x: x for x in range(3)})
+print(*lambda x: x)
for (x,) in (1,), (2,), (3,):
...
for y in ():