https://github.com/python/cpython/commit/8750e5ecfcfbc337efb511046d34f28b2d26bd68
commit: 8750e5ecfcfbc337efb511046d34f28b2d26bd68
branch: main
author: ggqlq <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-08-18T21:54:39+01:00
summary:

gh-134869: Fix Ctrl+C corrupts REPL  autocomplete (#134929)

files:
A Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst
M Lib/_pyrepl/simple_interact.py

diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py
index 965b853c34b392..ff1bdab9fea078 100644
--- a/Lib/_pyrepl/simple_interact.py
+++ b/Lib/_pyrepl/simple_interact.py
@@ -158,6 +158,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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to