From: Sergey Miryanov Date: Mon, 5 May 2025 14:54:19 +0000 (-0700) Subject: gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (... X-Git-Tag: v3.14.0b1~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99a0d7e5b3c6e80f5b9b0ec88ae439d6d620253c;p=thirdparty%2FPython%2Fcpython.git gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (#131910) Co-authored-by: Ɓukasz Langa --- diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index e2274629b651..b3848833e142 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -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 index 000000000000..79b23db6d0b7 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-03-30-19-58-14.gh-issue-131878.uxM26H.rst @@ -0,0 +1 @@ +Handle uncaught exceptions in the main input loop for the new REPL.