Skip to content

Expose the coroutine object in asyncio task objects #81180

Closed

Description

@agronholm
mannequin
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']

    Activity

    1. agronholm commented on May 21, 2019

      agronholmmannequin
      MannequinAuthor

      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.

    2. 1st1 commented on May 21, 2019

      @1st1
      Member

      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).

    3. agronholm commented on May 21, 2019

      agronholmmannequin
      MannequinAuthor

      I'll look into making a PR.

    4. miss-islington commented on May 30, 2019

      @miss-islington
      Contributor

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

    5. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions