Closed skgbanga closed 5 years ago
According to https://github.com/dabeaz/curio/blob/master/curio/errors.py TaskExit
inherits from Exception
not BaseException
. So either the code or the documentation needs to be changed.
Thanks @Dobatymo It seems the only exception which is derived from BaseException
is KernelExit
.
Yeah, the documentation is wrong and should be updated. Also, the doc on TaskExit
is not adequate. The example is a poor demonstration of TaskExit
:
TaskExit
, it's perfectly fine.TaskExit
is changed to some other user-defined exception, the example works fine, too.So, what is the point of TaskExit
?
I will review what's happening with TaskExit. I believe that the original intent was that if a task wanted to cleanly exit from a deeply nested set of calls, it could raise TaskExit much like normal code could raise SystemExit to cause Python to terminate. It's entirely possible that TaskExit isn't fully implemented. I will check.
Honestly, I don't know what TaskExit is used for or what I was thinking (apparently nothing). I thought about making it mean something more concrete, but I've decided to just delete it instead. If someone really wants something like this, they can just make their own custom exception and raise that.
In the curio task model following example is given to show
TaskExit
It is also mentioned that
TaskExit
is a subclass of BaseException, and wouldn't be caught by handlers looking forException
.As a result, I did not expect the above to print "Something went wrong"
However, I get the following output when I run the above example: