adafruit / adafruit/Adafruit_CircuitPython_asyncio

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

Open
#53 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
30
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Task implementation and the core loop that manages task state and data. Trace how completion, exceptions, and cancellation are recorded; done means tasks expose result(), exception(), and cancelled() with behavior consistent with the requested asyncio usage, backed by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.