Skip to content

bug: #348

Description

@vtnate

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-python

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

I'm trying PyScan to guard against AI slop in my repo, and it is erroring when parsing one of my Python 3.14 files. Their FAQ says to come here when encountering parse errors.

The problem line in my code appears to be: except KeyError, TypeError, ValueError

which was included in Python 3.14 with PEP 758.

I know tree-sitter tries to support the newest version of Python. Is this covered somewhere already and I am simply using it incorrectly? I haven't found an issue covering this yet.

Steps To Reproduce/Bad Parse Tree

Attempt to parse a try/except block with multiple exceptions and no parentheses (ruff removes the parens).

try:
    do_stuff()
except KeyError, TypeError, ValueError:
    return None

Expected Behavior/Parse Tree

I expect this to parse the same as if the exceptions were gathered into a tuple with parens.

except (KeyError, TypeError, ValueError)

Repro

# Example code that causes the issue
def foo():
  # Code that fails to parse, or causes an error
  ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions