Skip to content

Commit

Permalink
pythongh-121295: Fix blocked console after interrupting a long paste (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmacias95 authored Jul 15, 2024
1 parent 7d111da commit 498a94c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Lib/_pyrepl/simple_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,15 @@ def maybe_run_command(statement: 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

0 comments on commit 498a94c

Please sign in to comment.