Skip to content

Commit 2469066

Browse files
Fix asyncio.get_event_loop() documentation (GH-18051)
Mention that the function implicitly creates new event loop only if called from the main thread. (cherry picked from commit 2c49bec) Co-authored-by: Andrew Svetlov <[email protected]>
1 parent a360070 commit 2469066

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
@@ -34,8 +34,10 @@ an event loop:
3434

3535
.. function:: get_event_loop()
3636

37-
Get the current event loop. If there is no current event loop set
38-
in the current OS thread and :func:`set_event_loop` has not yet
37+
Get the current event loop.
38+
39+
If there is no current event loop set in the current OS thread,
40+
the OS thread is main, and :func:`set_event_loop` has not yet
3941
been called, asyncio will create a new event loop and set it as the
4042
current one.
4143

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)