Skip to content

ASYNC102 await-in-finally-or-cancelled false alarms on nurseries #283

Open
@jakkdl

Description

@jakkdl

try:
pass
finally:
# false alarm, open_nursery does not block/checkpoint on entry.
async with trio.open_nursery() as nursery: # error: 8, Statement("try/finally", lineno-4)
nursery.cancel_scope.deadline = trio.current_time() + 10
nursery.cancel_scope.shield = True
# false alarm, we currently don't handle nursery.cancel_scope.[deadline/shield]
await foo() # error: 12, Statement("try/finally", lineno-8)

TODO:

  • Special-case async with open_nursery(...), and async with anyio.create_task_group(...) as not being checkpoints. (also affects other rules)
  • handle [nursery_name].cancel_scope.[deadline/shield]

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