mirror of https://github.com/python/cpython
gh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)
This commit is contained in:
parent
4055577221
commit
69b3e8ea56
|
@ -216,11 +216,13 @@ class interrupt(FinishCommand):
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
self.reader.console.finish()
|
self.reader.console.finish()
|
||||||
|
self.reader.finish()
|
||||||
os.kill(os.getpid(), signal.SIGINT)
|
os.kill(os.getpid(), signal.SIGINT)
|
||||||
|
|
||||||
|
|
||||||
class ctrl_c(Command):
|
class ctrl_c(Command):
|
||||||
def do(self) -> None:
|
def do(self) -> None:
|
||||||
|
self.reader.console.finish()
|
||||||
self.reader.finish()
|
self.reader.finish()
|
||||||
raise KeyboardInterrupt
|
raise KeyboardInterrupt
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ def run_multiline_interactive_console(
|
||||||
assert not more
|
assert not more
|
||||||
input_n += 1
|
input_n += 1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
console.write("\nKeyboardInterrupt\n")
|
console.write("KeyboardInterrupt\n")
|
||||||
console.resetbuffer()
|
console.resetbuffer()
|
||||||
except MemoryError:
|
except MemoryError:
|
||||||
console.write("\nMemoryError\n")
|
console.write("\nMemoryError\n")
|
||||||
|
|
Loading…
Reference in New Issue