Skip to content

ASYNC102 should allow aclose_forcefully #446

@A5rocks

Description

@A5rocks
async def _run_handler(stream: StreamT, handler: Handler[StreamT]) -> None:
    try:
        await handler(stream)
    finally:
        await trio.aclose_forcefully(stream)  # E

this should be allowed, I think. It currently gets this error message:

src/trio/_highlevel_serve_listeners.py:36:9: ASYNC102 await inside try/finally on line 33 must have shielded cancel scope with a timeout.

but this relies on the implementation of aclose_forcefully, which is documented as cancelling immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    rule improvementImprovement for currently existing rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions