ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Parenthesized context managers raise E999

Open notypecheck opened this issue 3 years ago • 4 comments

Ruff version: 0.0.132 Ruff configuration: Default

Ruff reports E999 (Syntax Error) for parenthesized context managers that were introduced in python 3.10

This raises E999

test.py:2:15: E999 SyntaxError: invalid syntax. Got unexpected token 'as'
with (
    open("") as a,
    open("") as b,
):
    pass

However it works fine if you use \ to split line:

with open("") as a, \
    open("") as b:
    pass

notypecheck avatar Nov 21 '22 09:11 notypecheck

Related #54, #286

g-as avatar Nov 21 '22 13:11 g-as

👍 Unfortunately a known problem that I need to invest in resolving :) Same for structural pattern matching.

charliermarsh avatar Nov 21 '22 15:11 charliermarsh

Np, just made an issue so it's documented and is easier to find ❤️

notypecheck avatar Nov 21 '22 15:11 notypecheck

Always appreciated!

charliermarsh avatar Nov 21 '22 15:11 charliermarsh

Marking as a duplicate of #54.

charliermarsh avatar Dec 08 '22 18:12 charliermarsh