f2format icon indicating copy to clipboard operation
f2format copied to clipboard

yield in lambdas mishandled

Open pmp-p opened this issue 5 years ago • 1 comments

echo 'type((lambda: (yield))())' | ~/.local/bin/f2format -s 
Traceback (most recent call last):
  File "/Users/user/.local/bin/f2format", line 8, in <module>
    sys.exit(main())
  File "<string>", line None
bpc_utils.parsing.BPCSyntaxError: source file '<unknown>' contains the following syntax errors:
[L1C14] SyntaxError: 'yield' outside function

pmp-p avatar Dec 19 '20 02:12 pmp-p

This is yet another false positive from parso. It only checked whether yield is inside a funcdef context, while a lambdef context should also be acceptable.

gousaiyang avatar Dec 19 '20 02:12 gousaiyang