From 87b14c8f21bbd675a98f0ae02149d8376e8f8d3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Mon, 5 May 2025 17:20:54 +0200 Subject: [PATCH] [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 --- Lib/_pyrepl/simple_interact.py | 5 +++++ .../2025-03-30-19-58-14.gh-issue-131878.uxM26H.rst | 1 + 2 files changed, 6 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2025-03-30-19-58-14.gh-issue-131878.uxM26H.rst 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. -- 2.47.3