From 91031b9c86721512df6a64ccc7ae31936eb68d41 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sat, 18 Jan 2020 15:38:51 +0200 Subject: [PATCH] Fix asyncio.get_event_loop() documentation. Mention that the function implicitly creates new event loop only if called from the main thread. --- Doc/library/asyncio-eventloop.rst | 6 ++++-- .../Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2020-01-18-15-37-56.bpo-39381.wTWe8d.rst diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index ee995e04e47650..25a3692695d538 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 00000000000000..37b66ad9dfd178 --- /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.