https://github.com/python/cpython/commit/b3725651a26633cc75e977d2ea163060885fa58a
commit: b3725651a26633cc75e977d2ea163060885fa58a
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-08-18T22:21:26+01:00
summary:

[3.13] gh-134869: Fix Ctrl+C corrupts REPL  autocomplete (GH-134929) (#137925)

gh-134869: Fix Ctrl+C corrupts REPL  autocomplete (GH-134929)
(cherry picked from commit 8750e5ecfcfbc337efb511046d34f28b2d26bd68)

Co-authored-by: ggqlq <[email protected]>

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 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.

_______________________________________________
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