]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix asyncio.get_event_loop() documentation (GH-18051)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 20 Jan 2020 22:51:57 +0000 (14:51 -0800)
committerGitHub <noreply@github.com>
Mon, 20 Jan 2020 22:51:57 +0000 (14:51 -0800)
Mention that the function implicitly creates new event loop only if called from the main thread.
(cherry picked from commit 2c49becc69c05934996a00b902e4a4f089b91954)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Doc/library/asyncio-eventloop.rst
Misc/NEWS.d/next/Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst [new file with mode: 0644]

index d8e1a7443fa944d13c519d1ada4e3ef9fbac1b6c..97c1078022601b12fb1273b6eb35aa8990f2834a 100644 (file)
@@ -34,8 +34,10 @@ an event loop:
 
 .. function:: get_event_loop()
 
-   Get the current event loop.  If there is no current event loop set
-   in the current OS thread and :func:`set_event_loop` has not yet
+   Get the current event loop.
+
+   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
    current one.
 
diff --git a/Misc/NEWS.d/next/Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst b/Misc/NEWS.d/next/Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst
new file mode 100644 (file)
index 0000000..37b66ad
--- /dev/null
@@ -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.