Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

compat: interrupt using KeyboardInterrupt (#3703)

Akshay Agrawal7d68f208a912
diff --git a/marimo/_runtime/control_flow.py b/marimo/_runtime/control_flow.py
index 19920b3f84..1d92bee78e 100644
--- a/marimo/_runtime/control_flow.py
+++ b/marimo/_runtime/control_flow.py
@@ -3,15 +3,10 @@ from typing import Optional
from marimo._output.rich_help import mddoc
-
-class MarimoInterrupt(BaseException):
- """Raised when user stops execution of entire program with interrupt.
-
- Inherits from `BaseException` to prevent accidental capture with
- `except Exception` (similar to `KeyboardInterrupt`)
- """
-
- pass
+# We used to define a custom MarimoInterrupt BaseException to interrupt the
+# kernel; however, some third-party libraries like databricks-connect have
+# special case handling of KeyboardInterrupt.
+MarimoInterrupt = KeyboardInterrupt
class MarimoStopError(BaseException):