Skip to content
Evergreen Evergreen
Documentation

asyncio.get_event_loop warns when it has to create a loop

Deprecated. The source gives no day. Replacement: asyncio.run() at entry points, or asyncio.get_running_loop() inside coroutines. Source: What’s New in Python 3.12.

Check a version:

evergreen check pkg:generic/python

In Python 3.12 the default event loop policy’s get_event_loop() emits a DeprecationWarning when there is no current event loop and it decides to create one.

Look up another package or runtime · <form action="../lookup.html" method="get" role="search"> </form>

   
Status Deprecated
Severity medium
Ecosystem python
Component pkg:generic/python
Affected versions vers:pypi/>=3.12
Date from the source The source gives no day
Replacement asyncio.run() at entry points, or asyncio.get_running_loop() inside coroutines
Evidence last seen 2026-10-21
Reviewed 2026-10-21 by arminazimi
Review due 2027-10-21 (365 days after the last review)
Rule ID python.symbol.asyncio.get-event-loop

Sources

Migration

Constraints

  • Keep the behavior of the call unchanged; check the replacement’s argument and return-type differences.

Steps

  1. Stop creating loops implicitly. Use asyncio.run(main()) at the entry point and asyncio.get_running_loop() inside coroutines.

Verification

  • python -W error::DeprecationWarning -m pytest: Run the tests with deprecation warnings as errors when pytest is used.

Detected by

The python detector. See Detectors and Compatibility.

Other versions of this product

Same ecosystem

Data

This page is generated from registry/python.json, rule python.symbol.asyncio.get-event-loop, in the ebb.registry.v2 format (how rules are written). A CLE (ECMA-428) export is not published yet. The same facts are embedded in this page as schema.org structured data.

Last updated