]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (...
authorSergey Miryanov <sergey.miryanov@gmail.com>
Mon, 5 May 2025 14:54:19 +0000 (07:54 -0700)
committerGitHub <noreply@github.com>
Mon, 5 May 2025 14:54:19 +0000 (16:54 +0200)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Lib/_pyrepl/simple_interact.py
Misc/NEWS.d/next/Core_and_Builtins/2025-03-30-19-58-14.gh-issue-131878.uxM26H.rst [new file with mode: 0644]

index e2274629b651b900bc4bb8521fc730746f611217..b3848833e142089417992e09d9cfbc71bb98f71a 100644 (file)
@@ -162,3 +162,8 @@ def run_multiline_interactive_console(
         except MemoryError:
             console.write("\nMemoryError\n")
             console.resetbuffer()
+        except SystemExit:
+            raise
+        except:
+            console.showtraceback()
+            console.resetbuffer()
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-03-30-19-58-14.gh-issue-131878.uxM26H.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-03-30-19-58-14.gh-issue-131878.uxM26H.rst
new file mode 100644 (file)
index 0000000..79b23db
--- /dev/null
@@ -0,0 +1 @@
+Handle uncaught exceptions in the main input loop for the new REPL.