Skip to content

Commit 705a54c

Browse files
author
Vincent Michel
committed
Update BaseEventLoop.run_forever to set and clear the running loop
1 parent b30bcdc commit 705a54c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

asyncio/base_events.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,11 @@ def run_forever(self):
342342
self._set_coroutine_wrapper(self._debug)
343343
self._thread_id = threading.get_ident()
344344
try:
345-
while True:
346-
self._run_once()
347-
if self._stopping:
348-
break
345+
with self._running_context():
346+
while True:
347+
self._run_once()
348+
if self._stopping:
349+
break
349350
finally:
350351
self._stopping = False
351352
self._thread_id = None

0 commit comments

Comments
 (0)