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
{{ message }}
Repository navigation
Expose the coroutine object in asyncio task objects #81180
Both curio and trio expose the coroutine object belonging to a task as the "coro" attribute. Asyncio exposes this as "_coro" (as does uvloop) but it would be nice to have at least a read-only attribute exposing this as part of the public API.
In some of my libraries I need this object, sometimes for debugging and other times for implementing "crazy" schemes like running parts of the the coroutine function code in a worker thread.
I've no problem with this. We can add a 'get_coro()' Task method (this is in line with asyncio usually having the "getter" api as opposed to properties).
Activity
agronholm commentedon May 21, 2019
Both curio and trio expose the coroutine object belonging to a task as the "coro" attribute. Asyncio exposes this as "_coro" (as does uvloop) but it would be nice to have at least a read-only attribute exposing this as part of the public API.
In some of my libraries I need this object, sometimes for debugging and other times for implementing "crazy" schemes like running parts of the the coroutine function code in a worker thread.
1st1 commentedon May 21, 2019
I've no problem with this. We can add a 'get_coro()' Task method (this is in line with asyncio usually having the "getter" api as opposed to properties).
agronholm commentedon May 21, 2019
I'll look into making a PR.
miss-islington commentedon May 30, 2019
New changeset 98ef920 by Miss Islington (bot) (Alex Grönholm) in branch 'master':
bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
98ef920