[Python-checkins] Fix asyncio.get_event_loop() documentation (GH-18051)

Miss Islington (bot) webhook-mailer at python.org
Mon Jan 20 17:52:40 EST 2020


https://github.com/python/cpython/commit/6aeed01901d020363e383821b38614816d0b4032
commit: 6aeed01901d020363e383821b38614816d0b4032
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-01-20T14:52:35-08:00
summary:

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 2c49becc69c05934996a00b902e4a4f089b91954)

Co-authored-by: Andrew Svetlov <andrew.svetlov at gmail.com>

files:
A Misc/NEWS.d/next/Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst
M Doc/library/asyncio-eventloop.rst

diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index 7fed2c23df7d5..24f621e2d9fff 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -38,8 +38,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
index 0000000000000..37b66ad9dfd17
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst
@@ -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.



More information about the Python-checkins mailing list