Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-121295: Fix blocked console after interrupting a long paste (GH-12…
…1815)

(cherry picked from commit 498a94c)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
  • Loading branch information
mgmacias95 authored and miss-islington committed Jul 15, 2024
commit e18c6d01eb313e03e0d2c03ecea229dc03ce0fa2
10 changes: 9 additions & 1 deletion Lib/_pyrepl/simple_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,15 @@ def more_lines(unicodetext: str) -> bool:
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")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix PyREPL console getting into a blocked state after interrupting a long
paste