From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 18 Dec 2025 13:55:50 +0000 (+0100) Subject: [3.14] gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785) ... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f02231b8a0b2a4614ee894b4ebcb88259d460c0b;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785) (#142933) gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785) (cherry picked from commit ddfc155d3ade5f4867c6789136df73f61d4efb03) Co-authored-by: Bartosz Sławecki --- diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py index e07dd52a2a5e..898de0cb2eae 100644 --- a/Lib/asyncio/__main__.py +++ b/Lib/asyncio/__main__.py @@ -236,4 +236,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 index 000000000000..92a723cbc297 --- /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.