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

Add asyncio.get_running_loop() function #76450

1st1 opened this issue Dec 10, 2017 · 2 comments

Add asyncio.get_running_loop() function #76450

1st1 opened this issue Dec 10, 2017 · 2 comments
3.7 expert-asyncio type-feature


Copy link

@1st1 1st1 commented Dec 10, 2017

BPO 32269
Nosy @asvetlov, @1st1
  • #4782
  • 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 = ''
    closed_at = <Date 2017-12-11.15:08:02.879>
    created_at = <Date 2017-12-10.17:08:44.727>
    labels = ['type-feature', '3.7', 'expert-asyncio']
    title = 'Add `asyncio.get_running_loop()` function'
    updated_at = <Date 2017-12-11.15:08:52.294>
    user = '' fields:

    activity = <Date 2017-12-11.15:08:52.294>
    actor = 'yselivanov'
    assignee = 'yselivanov'
    closed = True
    closed_date = <Date 2017-12-11.15:08:02.879>
    closer = 'yselivanov'
    components = ['asyncio']
    creation = <Date 2017-12-10.17:08:44.727>
    creator = 'yselivanov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32269
    keywords = ['patch']
    message_count = 2.0
    messages = ['307961', '308051']
    nosy_count = 2.0
    nosy_names = ['asvetlov', 'yselivanov']
    pr_nums = ['4782']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = ''
    versions = ['Python 3.7']

    Copy link
    Member Author

    @1st1 1st1 commented Dec 10, 2017

    In many contexts asyncio._get_running_loop() is more useful than asyncio.get_event_loop(). The former function is predictable and simple, the latter can change its behaviour depending on the current policy and can even create new event loops.

    Both asyncio._get_running_loop() and asyncio._set_running_loop() are public asyncio API, although the leading underscore suggests that they are special and shouldn't be used by regular users. That's true for asyncio._set_running_loop(), which is intended to be used by event loops exclusively.

    I propose to remove the leading underscore from asyncio._get_running_loop(), making it asyncio.get_running_loop(), and thus promoting a safer alternative to asyncio.get_event_loop().

    asyncio._get_running_loop() will be deprecated and removed in Python 3.9.

    @1st1 1st1 self-assigned this Dec 10, 2017
    @1st1 1st1 added expert-asyncio 3.7 type-feature labels Dec 10, 2017
    @1st1 1st1 closed this as completed Dec 11, 2017
    Copy link
    Member Author

    @1st1 1st1 commented Dec 11, 2017

    asyncio._get_running_loop() will be deprecated and removed in Python 3.9.

    _get_running_loop() was left as-is.

    @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
    3.7 expert-asyncio type-feature
    None yet

    No branches or pull requests

    1 participant