Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

loop.run_forever can remove running loop if already running #130145

Closed
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error
@kumaraditya303

Description

@kumaraditya303

Reproducer:

importasyncioasyncdefmain():loop=asyncio.new_event_loop()try:loop.run_forever()exceptRuntimeError:passprint(asyncio.get_running_loop())asyncio.run(main())

Output:

cpython on  main [$?] via C v13.3.0-gcc via 🐍 v3.12.3./python main.pyTraceback (most recent call last):  File "/home/realkumaraditya/cpython/main.py", line 15, in <module>    asyncio.run(main())    ~~~~~~~~~~~^^^^^^^^  File "/home/realkumaraditya/cpython/Lib/asyncio/runners.py", line 204, in run    return runner.run(main)           ~~~~~~~~~~^^^^^^  File "/home/realkumaraditya/cpython/Lib/asyncio/runners.py", line 127, in run    return self._loop.run_until_complete(task)           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File "/home/realkumaraditya/cpython/Lib/asyncio/base_events.py", line 719, in run_until_complete    return future.result()           ~~~~~~~~~~~~~^^  File "/home/realkumaraditya/cpython/main.py", line 11, in main    print(asyncio.get_running_loop())          ~~~~~~~~~~~~~~~~~~~~~~~~^^RuntimeError: no running event loop/home/realkumaraditya/cpython/Lib/asyncio/base_events.py:758: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp