Skip to content

New rule: do not pass deadline=<constant> to CancelScope(), move_on_at(), or fail_at() #353

Closed
@Zac-HD

Description

@Zac-HD

These functions (docs) take a deadline= argument, which is defined relative to the current clock. That in turn means that there's never a good reason to pass a constant, but it's pretty easy to write nonsense without realizing:

with trio.fail_after(5): ...  # OK
with trio.fail_at(5): ...     # complete nonsense!

...but happily, it's also the kind of thing which is very easy to lint for.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions