diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-04 21:44:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 21:44:33 (GMT) |
commit | 4ac0ccf9d33349eb4024c4b1f4661ca4b7fd372c (patch) | |
tree | 4c94152a04f540a7234b7b48d9d5f94952f580f9 /Lib/_pyrepl | |
parent | a9e807fe44f581ae39f2fcc7a62c547f2f2eb6f2 (diff) | |
download | cpython-4ac0ccf9d33349eb4024c4b1f4661ca4b7fd372c.zip cpython-4ac0ccf9d33349eb4024c4b1f4661ca4b7fd372c.tar.gz cpython-4ac0ccf9d33349eb4024c4b1f4661ca4b7fd372c.tar.bz2 |
[3.13] gh-119553: Fix console when pressing Ctrl-C within a multiline block (GH-120075) (#120076)
(cherry picked from commit 69b3e8ea569faabccd74036e3d0e5ec7c0c62a20)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Lib/_pyrepl')
-rw-r--r-- | Lib/_pyrepl/commands.py | 2 | ||||
-rw-r--r-- | Lib/_pyrepl/simple_interact.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/_pyrepl/commands.py b/Lib/_pyrepl/commands.py index e94e8c25..6bffed1 100644 --- a/Lib/_pyrepl/commands.py +++ b/Lib/_pyrepl/commands.py @@ -216,11 +216,13 @@ class interrupt(FinishCommand): 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 diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index 256bbc7..2e5698e 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -149,7 +149,7 @@ def run_multiline_interactive_console( assert not more input_n += 1 except KeyboardInterrupt: - console.write("\nKeyboardInterrupt\n") + console.write("KeyboardInterrupt\n") console.resetbuffer() except MemoryError: console.write("\nMemoryError\n") |