diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index c6f40abfab4226..8148b19a942eb7 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -163,3 +163,8 @@ def maybe_run_command(statement: str) -> bool: 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 00000000000000..79b23db6d0b79e --- /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.