]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-134869: Fix Ctrl+C corrupts REPL autocomplete (GH-134929) (#137926)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 18 Aug 2025 21:21:55 +0000 (23:21 +0200)
committerGitHub <noreply@github.com>
Mon, 18 Aug 2025 21:21:55 +0000 (22:21 +0100)
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
Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst [new file with mode: 0644]

index 965b853c34b392e61a821de820d1ba074e074287..ff1bdab9fea0785d61740367a10809b5ae7497b3 100644 (file)
@@ -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 (file)
index 0000000..abb3579
--- /dev/null
@@ -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.