You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose that something like MultiError([KeyError(), Cancelled()]) arrives at a with fail_after(...). Right now the Cancelled is absorbed, and then the KeyError continues propagating, because fail_after only raises TooSlowError if the block exits without any exception.
An alternative that might make more sense is to use a MultiError.catch to replace each Cancelled with a TooSlowError. The tricky bit is that right now, the abstraction boundaries don't really give fail_after a way to do this -- the MultiError.catch is hidden inside the cancel scope.
One option would be to move this functionality into open_cancel_scope itself. Another would be to make the Cancelled._scope attribute public, allowing an implementation like:
(The other advantage of this is that it would preserve the traceback of the Cancelled error, which currently gets lost. This is useful to see what operation froze.)
The text was updated successfully, but these errors were encountered:
Suppose that something like
MultiError([KeyError(), Cancelled()])
arrives at awith fail_after(...)
. Right now theCancelled
is absorbed, and then theKeyError
continues propagating, becausefail_after
only raisesTooSlowError
if the block exits without any exception.An alternative that might make more sense is to use a
MultiError.catch
to replace eachCancelled
with aTooSlowError
. The tricky bit is that right now, the abstraction boundaries don't really givefail_after
a way to do this -- theMultiError.catch
is hidden inside the cancel scope.One option would be to move this functionality into
open_cancel_scope
itself. Another would be to make theCancelled._scope
attribute public, allowing an implementation like:(The other advantage of this is that it would preserve the traceback of the
Cancelled
error, which currently gets lost. This is useful to see what operation froze.)The text was updated successfully, but these errors were encountered: