[3.13] gh-130145: fix loop.run_forever when loop is already running (GH-130146) (#130147)

gh-130145: fix `loop.run_forever` when loop is already running (GH-130146)
(cherry picked from commit a545749b0e)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Miss Islington (bot) 2025-02-15 10:55:08 +01:00 committed by GitHub
parent 692d36f1fc
commit 1a7b8c0f4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 1 deletions

View file

@ -671,8 +671,8 @@ class BaseEventLoop(events.AbstractEventLoop):
def run_forever(self):
"""Run until stop() is called."""
self._run_forever_setup()
try:
self._run_forever_setup()
while True:
self._run_once()
if self._stopping: