mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
[3.13] gh-119553: Fix console when pressing Ctrl-C within a multiline block (GH-120075) (#120076)
(cherry picked from commit 69b3e8ea56
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
a9e807fe44
commit
4ac0ccf9d3
2 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue