adafruit / Adafruit_CircuitPython_asyncio

CIrcuitPython subset of CPython asyncio library
MIT License
28 stars 16 forks source link

Support Task methods `result()`, `exception()`, and `cancelled()` #53

Open imnotjames opened 1 year ago

imnotjames commented 1 year ago

CPython's tasks are subclasses of PyFuture. This means they have result, exception methods. They also have a cancelled method.

As a user of the asyncio library I want the circuitpython library to support these so I can inspect tasaks more easily from outside asyncio - eg, without having to muck around with CircuitPython asyncio task internals like state or data.

This would require some changes to the core loop for setting these values, but shouldn't be a huge difficulty otherwise? It should be negligible for memory usage / library footprint / etc, unless I'm misunderstanding how the library operates today.

imnotjames commented 1 year ago

If this is to be supported then it needs to first be handled in _asyncio then updated here.