You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#584 added parenthesized with statements to the native parser, but they’re only accepted when a trailing comma is present. Python accepts them with or without a trailing comma.
$ pip freezelibcst==0.4.9mypy-extensions==0.4.3PyYAML==6.0typing-inspect==0.8.0typing_extensions==4.4.0
$ export LIBCST_PARSER_TYPE=native
$ python3 -c 'import libcst; libcst.parse_statement("with (a as a, b as b,): pass")'
$ python3 -c 'import libcst; libcst.parse_statement("with (a as a, b as b): pass")'Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/v/lib/python3.10/site-packages/libcst/_parser/entrypoints.py", line 138, in parse_statement result = _parse( File "/tmp/v/lib/python3.10/site-packages/libcst/_parser/entrypoints.py", line 55, in _parse return parse(source_str)libcst._exceptions.ParserSyntaxError: Syntax Error @ 1:1.parser error: error at 1:20: expected *with (a as a, b as b): pass^
This is slightly buggy due to Instagram/LibCST#855; it will complain `[ERROR] Failed to fix nested with: Failed to extract CST from source` when trying to fix nested parenthesized `with` statements lacking trailing commas. But presumably people who write parenthesized `with` statements already knew that they don’t need to nest them.
Signed-off-by: Anders Kaseorg <[email protected]>
#584 added parenthesized
with
statements to the native parser, but they’re only accepted when a trailing comma is present. Python accepts them with or without a trailing comma.Cc @stroxler
The text was updated successfully, but these errors were encountered: