gh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)

This commit is contained in:
Lysandros Nikolaou 2024-06-04 23:22:28 +02:00 committed by GitHub
parent 4055577221
commit 69b3e8ea56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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")