summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarta Gómez Macías <mgmacias@google.com>2024-07-15 23:38:54 (GMT)
committerGitHub <noreply@github.com>2024-07-15 23:38:54 (GMT)
commit498a94c198e72525b8a7f4cb4f4a8957560f593a (patch)
treeb01d12240473508ee8e9fb74a95199bf71626faa
parent7d111dac160c658b277ec0fac75eee8edcfbe9dc (diff)
downloadcpython-498a94c198e72525b8a7f4cb4f4a8957560f593a.zip
cpython-498a94c198e72525b8a7f4cb4f4a8957560f593a.tar.gz
cpython-498a94c198e72525b8a7f4cb4f4a8957560f593a.tar.bz2
gh-121295: Fix blocked console after interrupting a long paste (GH-121815)
-rw-r--r--Lib/_pyrepl/simple_interact.py10
-rw-r--r--Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst2
2 files changed, 11 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")
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst
new file mode 100644
index 0000000..7fca7d5
--- /dev/null
+++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst
@@ -0,0 +1,2 @@
+Fix PyREPL console getting into a blocked state after interrupting a long
+paste