From: Ɓukasz Langa Date: Mon, 5 May 2025 15:20:54 +0000 (+0200) Subject: [3.13] gh-131878: Handle top level exceptions in new pyrepl and prevent of closing... X-Git-Tag: v3.13.4~166 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87b14c8f21bbd675a98f0ae02149d8376e8f8d3d;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-131878: Handle top level exceptions in new pyrepl and prevent of closing it (GH-131910) (GH-133445) Co-authored-by: Sergey Miryanov --- diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index c6f40abfab42..8148b19a942e 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -163,3 +163,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.