Skip to content

Unable to parse parenthesized context managers #4145

Closed
@charliermarsh

Description

@charliermarsh

In RustPython, this fails to parse:

from contextlib import contextmanager

@contextmanager
def ctx():
    yield

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

...with:

---- parser::tests::test_parse_parenthesized stdout ----
thread 'parser::tests::test_parse_parenthesized' panicked at 'called `Result::unwrap()` on an `Err` value: BaseError { error: UnrecognizedToken(As, None), location: Location { row: 7, column: 13 }, source_path: "<test>" }', compiler/parser/src/parser.rs:209:58
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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