Skip to content

Cannot use except without parentheses #1443

@dr-carlos

Description

@dr-carlos

#1344 Was closed, but libcst is still raising a ParserSyntaxError when using except without parentheses.

Example:

import ast, libcst

block = """try:
  pass
except A, B, C:
  pass"""

ast.parse(block) # Module(...)

libcst.parse_module(block) # Error!

This raises

libcst._exceptions.ParserSyntaxError: Syntax Error @ 4:7.
parser error: error at 3:10: expected one of !=, %, &, (, *, **, +, -, ., /, //, :, <, <<, <=, ==, >, >=, >>, @, [, ^, and, as, if, in, is, not, or, |

  pass
      ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions