Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 2c49bec

Browse files
authored
Fix asyncio.get_event_loop() documentation (pythonGH-18051)
Mention that the function implicitly creates new event loop only if called from the main thread.
1 parent 1e420f8 commit 2c49bec

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ an event loop:
3838

3939
.. function:: get_event_loop()
4040

41-
Get the current event loop. If there is no current event loop set
42-
in the current OS thread and :func:`set_event_loop` has not yet
41+
Get the current event loop.
42+
43+
If there is no current event loop set in the current OS thread,
44+
the OS thread is main, and :func:`set_event_loop` has not yet
4345
been called, asyncio will create a new event loop and set it as the
4446
current one.
4547

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Mention in docs that :func:`asyncio.get_event_loop` implicitly creates new
2+
event loop only if called from the main thread.

0 commit comments

Comments
 (0)