https://github.com/python/cpython/commit/69b3e8ea569faabccd74036e3d0e5ec7c0c62a20
commit: 69b3e8ea569faabccd74036e3d0e5ec7c0c62a20
branch: main
author: Lysandros Nikolaou <[email protected]>
committer: lysnikolaou <[email protected]>
date: 2024-06-04T23:22:28+02:00
summary:
gh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)
files:
M Lib/_pyrepl/commands.py
M Lib/_pyrepl/simple_interact.py
diff --git a/Lib/_pyrepl/commands.py b/Lib/_pyrepl/commands.py
index e94e8c25d379c1..6bffed1bfe9327 100644
--- a/Lib/_pyrepl/commands.py
+++ b/Lib/_pyrepl/commands.py
@@ -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
diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py
index 256bbc7c6d7626..2e5698eb131684 100644
--- a/Lib/_pyrepl/simple_interact.py
+++ b/Lib/_pyrepl/simple_interact.py
@@ -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")
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]