feat: support task methods for exception and result#54
feat: support task methods for exception and result#54imnotjames wants to merge 1 commit intoadafruit:mainfrom
exception and result#54Conversation
d5f2123 to
9a63a27
Compare
|
@imnotjames I thought I saw some questions from you about where to add exceptions, how close we should adhere to CPython, etc., but I cannot find them. Did you ask them here and then delete them? I cannot find them in discord either.
|
|
@dhalbert No worries! It was in discord, there was a bit of a wall of text and then a question, so totally understandable to miss it.
If they are needed during compile time then it means I'd move I might have answered my own question via some attempts to make it work any other way, though -- I can't find a way to reference the |
|
Got it. Any exception referenced by C has to be defined in C (or else defined at runtime in some tortuous way, which we wouldn't normally do). So definitely just define it like the other |
9a63a27 to
74a0033
Compare
Adds the following methods to the
Taskclass to bring it closer in line with CPythonget_coro- a method that returns the micropython specificTask.coropropertyresult- returns the result if no exception was raised or raised the exception that this task hadexception- returns the exception if an exception was raisedcancelled- returns true if this task had been cancelledset_exception- exists on the class but always raises an exception per CPython's implementationset_result- exists on the class but always raises an exception per CPython implementationTask.cancelwas updated to support amsgparameter which is passed to theCancelledErrorIn progress is
add_done_callbackandremove_done_callback- these currently raise aNotImplementedErrorbut are how CPython manages the done callbacks (unlike CircuitPython supporting via modifyingTask.state)This requires changes to
circuitpython's_asyncioto properly work.fixes #53