From: ggqlq <124190229+ggqlq@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:54:39 +0000 (+0800) Subject: gh-134869: Fix Ctrl+C corrupts REPL autocomplete (#134929) X-Git-Tag: v3.15.0a1~650 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8750e5ecfcfbc337efb511046d34f28b2d26bd68;p=thirdparty%2FPython%2Fcpython.git gh-134869: Fix Ctrl+C corrupts REPL autocomplete (#134929) --- diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index 965b853c34b3..ff1bdab9fea0 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -158,6 +158,7 @@ def run_multiline_interactive_console( 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 000000000000..abb3579aa912 --- /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.