Skip to content

Crash on parenthesized with statement #54

@antonagestam

Description

@antonagestam

I tried running ruff on a large project, which resulted in this crash:

[2022-08-31][10:33:40][ruff][ERROR] Failed to check repr-with.py: invalid syntax. Got unexpected token 'as' at line 9 column 13

It seems like the crash happens on parenthesized context managers introduced in Python 3.10. Minimal reproducible example:

from contextlib import contextmanager

@contextmanager
def ctx():
    yield

with (ctx() as foo):
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions