Skip to content

Commit

Permalink
pythongh-119553: Fix console when pressing Ctrl-C within a multiline …
Browse files Browse the repository at this point in the history
…block (python#120075)
  • Loading branch information
lysnikolaou authored Jun 4, 2024
1 parent 4055577 commit 69b3e8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Lib/_pyrepl/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,13 @@ def do(self) -> None:
import signal

self.reader.console.finish()
self.reader.finish()
os.kill(os.getpid(), signal.SIGINT)


class ctrl_c(Command):
def do(self) -> None:
self.reader.console.finish()
self.reader.finish()
raise KeyboardInterrupt

Expand Down
2 changes: 1 addition & 1 deletion Lib/_pyrepl/simple_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def more_lines(unicodetext: str) -> bool:
assert not more
input_n += 1
except KeyboardInterrupt:
console.write("\nKeyboardInterrupt\n")
console.write("KeyboardInterrupt\n")
console.resetbuffer()
except MemoryError:
console.write("\nMemoryError\n")
Expand Down

0 comments on commit 69b3e8e

Please sign in to comment.