https://github.com/python/cpython/commit/4ac0ccf9d33349eb4024c4b1f4661ca4b7fd372c
commit: 4ac0ccf9d33349eb4024c4b1f4661ca4b7fd372c
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: lysnikolaou <[email protected]>
date: 2024-06-04T21:44:33Z
summary:

[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 <[email protected]>

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]

Reply via email to