]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-121295: Fix blocked console after interrupting a long paste (GH-121815...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 16 Jul 2024 06:29:04 +0000 (08:29 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 06:29:04 +0000 (08:29 +0200)
(cherry picked from commit 498a94c198e72525b8a7f4cb4f4a8957560f593a)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Lib/_pyrepl/simple_interact.py
Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst [new file with mode: 0644]

index 30a128a1218384fed210de4b76fd651cd312436d..2c3dffe070c629621ee090278c820202a387bb59 100644 (file)
@@ -157,7 +157,15 @@ def run_multiline_interactive_console(
             assert not more
             input_n += 1
         except KeyboardInterrupt:
-            console.write("KeyboardInterrupt\n")
+            r = _get_reader()
+            if r.last_command and 'isearch' in r.last_command.__name__:
+                r.isearch_direction = ''
+                r.console.forgetinput()
+                r.pop_input_trans()
+                r.dirty = True
+            r.refresh()
+            r.in_bracketed_paste = False
+            console.write("\nKeyboardInterrupt\n")
             console.resetbuffer()
         except MemoryError:
             console.write("\nMemoryError\n")
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-15-20-03-29.gh-issue-121295.w53ucI.rst
new file mode 100644 (file)
index 0000000..7fca7d5
--- /dev/null
@@ -0,0 +1,2 @@
+Fix PyREPL console getting into a blocked state after interrupting a long
+paste