Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77106b2

Browse files
pablogsal1st1
authored andcommitted
bpo-32114: Updated the documentation for get_event_loop to reflect the policy change (#4510)
1 parent f658641 commit 77106b2

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Doc/library/asyncio-eventloops.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,15 @@ An event loop policy must implement the following interface:
189189

190190

191191
The default policy defines context as the current thread, and manages an event
192-
loop per thread that interacts with :mod:`asyncio`. If the current thread
193-
doesn't already have an event loop associated with it, the default policy's
194-
:meth:`~AbstractEventLoopPolicy.get_event_loop` method creates one when
195-
called from the main thread, but raises :exc:`RuntimeError` otherwise.
192+
loop per thread that interacts with :mod:`asyncio`. An exception to this rule
193+
happens when :meth:`~AbstractEventLoopPolicy.get_event_loop` is called from a
194+
running future/coroutine, in which case it will return the current loop
195+
running that future/coroutine.
196+
197+
If the current thread doesn't already have an event loop associated with it,
198+
the default policy's :meth:`~AbstractEventLoopPolicy.get_event_loop` method
199+
creates one when called from the main thread, but raises :exc:`RuntimeError`
200+
otherwise.
196201

197202

198203
Access to the global loop policy

0 commit comments

Comments
 (0)