https://github.com/python/cpython/commit/d6aa7e1d3d6b8ed99826c256b3775d833011af2a
commit: d6aa7e1d3d6b8ed99826c256b3775d833011af2a
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-12-18T22:34:03+05:30
summary:

[3.13] gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785) 
(#142932)

gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785)
(cherry picked from commit ddfc155d3ade5f4867c6789136df73f61d4efb03)

Co-authored-by: Bartosz SÅ‚awecki <[email protected]>

files:
A Misc/NEWS.d/next/Library/2025-12-16-04-39-27.gh-issue-142784.HBGJag.rst
M Lib/asyncio/__main__.py

diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py
index 8e9af83cc8af8f..62f65192df7091 100644
--- a/Lib/asyncio/__main__.py
+++ b/Lib/asyncio/__main__.py
@@ -202,4 +202,5 @@ def interrupt(self) -> None:
             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
index 00000000000000..92a723cbc29739
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-12-16-04-39-27.gh-issue-142784.HBGJag.rst
@@ -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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to