]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142784: make the asyncio REPL call `loop.close()` at exit (#142785)
authorBartosz Sławecki <bartosz@ilikepython.com>
Thu, 18 Dec 2025 13:00:12 +0000 (14:00 +0100)
committerGitHub <noreply@github.com>
Thu, 18 Dec 2025 13:00:12 +0000 (13:00 +0000)
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 d078ebfa4cedbe406fe1dbe2ff3234ca9a9c9b41..89d456b6858c07f3814c6bf8d243ff9bdec4e458 100644 (file)
@@ -240,4 +240,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.