From 0958d0f4a5e65c0002992dcab9aa98d0750c4b41 Mon Sep 17 00:00:00 2001 From: ggqlq <124190229+ggqlq@users.noreply.github.com> Date: Tue, 19 Aug 2025 04:54:39 +0800 Subject: [PATCH] gh-134869: Fix Ctrl+C corrupts REPL autocomplete (GH-134929) (cherry picked from commit 8750e5ecfcfbc337efb511046d34f28b2d26bd68) Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com> --- Lib/_pyrepl/simple_interact.py | 1 + .../next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index e686526870e364..8fb2359fb51e8a 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -156,6 +156,7 @@ def maybe_run_command(statement: str) -> bool: input_n += 1 except KeyboardInterrupt: r = _get_reader() + r.cmpltn_reset() if r.input_trans is r.isearch_trans: r.do_cmd(("isearch-end", [""])) r.pos = len(r.get_unicode()) diff --git a/Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst b/Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst new file mode 100644 index 00000000000000..abb3579aa912d1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst @@ -0,0 +1 @@ +Fix an issue where pressing Ctrl+C during tab completion in the REPL would leave the autocompletion menu in a corrupted state.