]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 18 Dec 2025 17:04:03 +0000 (18:04 +0100)
committerGitHub <noreply@github.com>
Thu, 18 Dec 2025 17:04:03 +0000 (22:34 +0530)
gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785)
(cherry picked from commit ddfc155d3ade5f4867c6789136df73f61d4efb03)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Lib/asyncio/__main__.py
Misc/NEWS.d/next/Library/2025-12-16-04-39-27.gh-issue-142784.HBGJag.rst [new file with mode: 0644]

index 8e9af83cc8af8f4580fed3e3500959a041e19c3f..62f65192df70912f8de26ce34c1a6b3b2a53f5fe 100644 (file)
@@ -202,4 +202,5 @@ if __name__ == '__main__':
             break
 
     console.write('exiting asyncio REPL...\n')
+    loop.close()
     sys.exit(return_code)
diff --git a/Misc/NEWS.d/next/Library/2025-12-16-04-39-27.gh-issue-142784.HBGJag.rst b/Misc/NEWS.d/next/Library/2025-12-16-04-39-27.gh-issue-142784.HBGJag.rst
new file mode 100644 (file)
index 0000000..92a723c
--- /dev/null
@@ -0,0 +1,3 @@
+The :mod:`asyncio` REPL now properly closes the loop upon the end of interactive session.
+Previously, it could cause surprising warnings.
+Contributed by Bartosz SÅ‚awecki.