-
-
Notifications
You must be signed in to change notification settings - Fork 363
Open
Description
After #3010 we will have the following functionality:
my_move_on_at = move_on_at(5)
assert my_move_on_at.deadline == 5
my_move_on_after = move_on_after(5)
assert my_move_on_after.deadline == 5
# but these return Generator[CancelScope], so you can't inspect/modify the objects
my_fail_at = fail_at(5)
assert my_fail_at.deadline == 5 # AttributeError
my_fail_after = fail_after(5)
assert my_fail_after.deadline == 5 # AttributeError
Since separating initialization & entry has been weird previously the current demand might be low for this functionality, but it might become more common.
The two ways I see of fixing this are:
- Add a wrapper class that defines
__exit__
to raiseTooSlowError
ifcancelled_caught
, but otherwise passes__getattr__
and__setattr__
ontoCancelScope
- Add a
fail=True
parameter toCancelScope
that makes it raiseTooSlowError
upon being cancelled.
Split out from #3010 (comment)
Metadata
Metadata
Assignees
Labels
No labels