Skip to content

gh-121295: Fix blocked console after interrupting a long paste #121815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 15, 2024
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
10 changes: 9 additions & 1 deletion Lib/_pyrepl/simple_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,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
Comment on lines +1 to +2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny wording nitpick:

Suggested change
Fix PyREPL console getting into a blocked state after interrupting a long
paste
Fixed REPL getting into a blocked state after interruption of
paste.

Loading