Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the coroutine object in asyncio task objects #81180

Closed
agronholm mannequin opened this issue May 21, 2019 · 4 comments
Closed

Expose the coroutine object in asyncio task objects #81180

agronholm mannequin opened this issue May 21, 2019 · 4 comments
Labels
3.8 only security fixes topic-asyncio type-feature A feature request or enhancement

Comments

@agronholm
Copy link
Mannequin

agronholm mannequin commented May 21, 2019

BPO 36999
Nosy @asvetlov, @agronholm, @1st1, @miss-islington
PRs
  • bpo-36999: Add asyncio.Task.get_coro() #13680
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-30.15:34:33.630>
    created_at = <Date 2019-05-21.20:45:37.484>
    labels = ['type-feature', '3.8', 'expert-asyncio']
    title = 'Expose the coroutine object in asyncio task objects'
    updated_at = <Date 2019-05-30.15:34:33.630>
    user = 'https://github.com/agronholm'

    bugs.python.org fields:

    activity = <Date 2019-05-30.15:34:33.630>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-30.15:34:33.630>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2019-05-21.20:45:37.484>
    creator = 'alex.gronholm'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36999
    keywords = ['patch']
    message_count = 4.0
    messages = ['343092', '343093', '343095', '343982']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'alex.gronholm', 'yselivanov', 'miss-islington']
    pr_nums = ['13680']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue36999'
    versions = ['Python 3.8']

    @agronholm
    Copy link
    Mannequin Author

    agronholm mannequin commented 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.

    @agronholm agronholm mannequin added 3.8 only security fixes topic-asyncio type-feature A feature request or enhancement labels May 21, 2019
    @1st1
    Copy link
    Member

    1st1 commented 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
    Copy link
    Mannequin Author

    agronholm mannequin commented May 21, 2019

    I'll look into making a PR.

    @miss-islington
    Copy link
    Contributor

    New changeset 98ef920 by Miss Islington (bot) (Alex Grönholm) in branch 'master':
    bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
    98ef920

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes topic-asyncio type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants