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 2c49becc69
)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
parent
a360070121
commit
2469066a4b
|
@ -34,8 +34,10 @@ an event loop:
|
||||||
|
|
||||||
.. function:: get_event_loop()
|
.. function:: get_event_loop()
|
||||||
|
|
||||||
Get the current event loop. If there is no current event loop set
|
Get the current event loop.
|
||||||
in the current OS thread and :func:`set_event_loop` has not yet
|
|
||||||
|
If there is no current event loop set in the current OS thread,
|
||||||
|
the OS thread is main, and :func:`set_event_loop` has not yet
|
||||||
been called, asyncio will create a new event loop and set it as the
|
been called, asyncio will create a new event loop and set it as the
|
||||||
current one.
|
current one.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Mention in docs that :func:`asyncio.get_event_loop` implicitly creates new
|
||||||
|
event loop only if called from the main thread.
|
Loading…
Reference in New Issue