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

Implement asyncio._get_running_loop() and get_event_loop() in C #76477

Closed
1st1 opened this issue Dec 12, 2017 · 6 comments
Closed

Implement asyncio._get_running_loop() and get_event_loop() in C #76477

1st1 opened this issue Dec 12, 2017 · 6 comments
Assignees
Labels
3.7 (EOL) end of life performance Performance or resource usage topic-asyncio

Comments

@1st1
Copy link
Member

1st1 commented Dec 12, 2017

BPO 32296
Nosy @vstinner, @asvetlov, @ambv, @1st1
PRs
  • bpo-32296: Implement asyncio.get_event_loop and _get_running_loop in C. #4827
  • bpo-32296: Unbreak tests on Windows #4850
  • bpo-32296: Make get_running_loop() another 4-5x faster #5277
  • 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 = 'https://github.com/1st1'
    closed_at = <Date 2017-12-18.10:56:09.066>
    created_at = <Date 2017-12-12.22:59:23.286>
    labels = ['expert-asyncio', '3.7', 'performance']
    title = 'Implement asyncio._get_running_loop() and get_event_loop() in C'
    updated_at = <Date 2018-01-23.20:10:05.974>
    user = 'https://github.com/1st1'

    bugs.python.org fields:

    activity = <Date 2018-01-23.20:10:05.974>
    actor = 'yselivanov'
    assignee = 'yselivanov'
    closed = True
    closed_date = <Date 2017-12-18.10:56:09.066>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2017-12-12.22:59:23.286>
    creator = 'yselivanov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32296
    keywords = ['patch']
    message_count = 6.0
    messages = ['308169', '308237', '308247', '308253', '308261', '310520']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'asvetlov', 'lukasz.langa', 'yselivanov']
    pr_nums = ['4827', '4850', '5277']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue32296'
    versions = ['Python 3.7']

    @1st1
    Copy link
    Member Author

    1st1 commented Dec 12, 2017

    asyncio.get_event_loop(), and, subsequently asyncio._get_running_loop() are one of the most frequently executed functions in asyncio. They also can't be sped up by third-party event loops like uvloop.

    When implemented in C they become 4x faster.

    @1st1 1st1 added the 3.7 (EOL) end of life label Dec 12, 2017
    @1st1 1st1 self-assigned this Dec 12, 2017
    @1st1
    Copy link
    Member Author

    1st1 commented Dec 13, 2017

    New changeset a70232f by Yury Selivanov in branch 'master':
    bpo-32296: Implement asyncio.get_event_loop and _get_running_loop in C. (bpo-4827)
    a70232f

    @1st1 1st1 closed this as completed Dec 13, 2017
    @1st1 1st1 added the performance Performance or resource usage label Dec 13, 2017
    @vstinner
    Copy link
    Member

    Hum, sometimes it's better to wait for AppVeyor :-) You broke all Windows buildbots! :-) Example:

    http://buildbot.python.org/all/#/builders/40/builds/278

    ======================================================================
    ERROR: test_get_event_loop_returns_running_loop (test.test_asyncio.test_events.TestCGetEventLoop)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_asyncio\test_events.py", line 2738, in setUp
        watcher = asyncio.SafeChildWatcher()
    AttributeError: module 'asyncio' has no attribute 'SafeChildWatcher'

    ======================================================================
    ERROR: test_get_event_loop_returns_running_loop (test.test_asyncio.test_events.TestPyGetEventLoop)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_asyncio\test_events.py", line 2738, in setUp
        watcher = asyncio.SafeChildWatcher()
    AttributeError: module 'asyncio' has no attribute 'SafeChildWatcher'

    @vstinner vstinner reopened this Dec 13, 2017
    @1st1
    Copy link
    Member Author

    1st1 commented Dec 13, 2017

    Thanks Victor. I've made a PR to fix this.

    @1st1
    Copy link
    Member Author

    1st1 commented Dec 13, 2017

    New changeset bfbf04e by Yury Selivanov in branch 'master':
    bpo-32296: Unbreak tests on Windows (bpo-4850)
    bfbf04e

    @1st1
    Copy link
    Member Author

    1st1 commented Jan 23, 2018

    New changeset 9d411c1 by Yury Selivanov in branch 'master':
    bpo-32296: Make get_running_loop() another 4-5x faster (bpo-5277)
    9d411c1

    @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.7 (EOL) end of life performance Performance or resource usage topic-asyncio
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants