diff options
author | Marta Gómez Macías <mgmacias@google.com> | 2024-07-15 23:38:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-15 23:38:54 (GMT) |
commit | 498a94c198e72525b8a7f4cb4f4a8957560f593a (patch) | |
tree | b01d12240473508ee8e9fb74a95199bf71626faa /Lib/_pyrepl | |
parent | 7d111dac160c658b277ec0fac75eee8edcfbe9dc (diff) | |
download | cpython-498a94c198e72525b8a7f4cb4f4a8957560f593a.zip cpython-498a94c198e72525b8a7f4cb4f4a8957560f593a.tar.gz cpython-498a94c198e72525b8a7f4cb4f4a8957560f593a.tar.bz2 |
gh-121295: Fix blocked console after interrupting a long paste (GH-121815)
Diffstat (limited to 'Lib/_pyrepl')
-rw-r--r-- | Lib/_pyrepl/simple_interact.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index 30a128a..2c3dffe 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -157,7 +157,15 @@ def run_multiline_interactive_console( assert not more input_n += 1 except KeyboardInterrupt: - console.write("KeyboardInterrupt\n") + r = _get_reader() + if r.last_command and 'isearch' in r.last_command.__name__: + r.isearch_direction = '' + r.console.forgetinput() + r.pop_input_trans() + r.dirty = True + r.refresh() + r.in_bracketed_paste = False + console.write("\nKeyboardInterrupt\n") console.resetbuffer() except MemoryError: console.write("\nMemoryError\n") |