From 925625447f72e104d0de7f1ef2722bd8ad21d58c Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 9 Oct 2025 18:13:11 +0200 Subject: [PATCH] [3.14] gh-139845: do not print twice in default asyncio REPL (GH-139846) (#139859) gh-139845: do not print twice in default asyncio REPL (GH-139846) (cherry picked from commit a310b3a99d05e107963023a5736b67afe4ae1968) Co-authored-by: yihong Co-authored-by: Kumar Aditya --- Lib/asyncio/__main__.py | 3 ++- .../Library/2025-10-09-21-37-20.gh-issue-139845.dzx5UP.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2025-10-09-21-37-20.gh-issue-139845.dzx5UP.rst diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py index ff3a69d1e172..e07dd52a2a5e 100644 --- a/Lib/asyncio/__main__.py +++ b/Lib/asyncio/__main__.py @@ -74,7 +74,8 @@ class AsyncIOInteractiveConsole(InteractiveColoredConsole): return except BaseException: if keyboard_interrupted: - self.write("\nKeyboardInterrupt\n") + if not CAN_USE_PYREPL: + self.write("\nKeyboardInterrupt\n") else: self.showtraceback() return self.STATEMENT_FAILED diff --git a/Misc/NEWS.d/next/Library/2025-10-09-21-37-20.gh-issue-139845.dzx5UP.rst b/Misc/NEWS.d/next/Library/2025-10-09-21-37-20.gh-issue-139845.dzx5UP.rst new file mode 100644 index 000000000000..3cd294e49cdd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-10-09-21-37-20.gh-issue-139845.dzx5UP.rst @@ -0,0 +1 @@ +Fix to not print KeyboardInterrupt twice in default asyncio REPL. -- 2.47.3