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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
feat: Post mortem for debugging failures (#4816)
Dylan Madisettif5d439304df9
diff --git a/Makefile b/Makefileindex 51c512e723..f247756d2e 100644--- a/Makefile+++ b/Makefile@@ -101,7 +101,7 @@ fe-typecheck:.PHONY: fe-codegen# 🔄 Generate frontend APIfe-codegen:- uv run marimo development openapi > openapi/api.yaml; \+ uv run ./marimo development openapi > openapi/api.yaml; \cd openapi; pnpm install; pnpm codegen; \biome format --fix src/api.ts;diff --git a/frontend/src/components/editor/output/MarimoTracebackOutput.tsx b/frontend/src/components/editor/output/MarimoTracebackOutput.tsxindex 1cdfe4d8f5..2144cb5116 100644--- a/frontend/src/components/editor/output/MarimoTracebackOutput.tsx+++ b/frontend/src/components/editor/output/MarimoTracebackOutput.tsx@@ -23,6 +23,7 @@ import { useState } from "react";import { useAtomValue } from "jotai";import { aiEnabledAtom } from "@/core/config/config";import { Element, Text, type DOMNode } from "html-react-parser";+import { isWasm } from "@/core/wasm/utils";import { CellLinkTraceback } from "../links/cell-link";import {@@ -43,6 +44,8 @@ import { Kbd } from "@/components/ui/kbd";import { insertDebuggerAtLine } from "@/core/codemirror/editing/debugging";import { getCellEditorView } from "@/core/cells/cells";+import { sendPdb } from "@/core/network/requests";+interface Props {cellId: CellId | undefined;traceback: string;@@ -69,7 +72,7 @@ export const MarimoTracebackOutput = ({const aiEnabled = useAtomValue(aiEnabledAtom);// Get last traceback info- const lastTracebackInfo = extractAllTracebackInfo(traceback)?.at(-1);+ const tracebackInfo = extractAllTracebackInfo(traceback)?.at(0);const handleRefactorWithAI = () => {onRefactorWithAI?.({@@ -110,20 +113,19 @@ export const MarimoTracebackOutput = ({Fix with AI</Button>)}- {lastTracebackInfo && (- <Button- size="xs"- variant="outline"- onClick={() => {- const view = getCellEditorView(lastTracebackInfo.cellId);- if (view) {- insertDebuggerAtLine(view, lastTracebackInfo.lineNumber);- }- }}- >- <BugPlayIcon className="h-3 w-3 mr-2" />- Insert breakpoint- </Button>+ {tracebackInfo && !isWasm() && (+ <Tooltip content={"Attach pdb to the exception point."}>+ <Button+ size="xs"+ variant="outline"+ onClick={() => {+ sendPdb({ cellId: tracebackInfo.cellId });+ }}+ >+ <BugPlayIcon className="h-3 w-3 mr-2" />+ Launch debugger+ </Button>+ </Tooltip>)}<DropdownMenu><DropdownMenuTrigger asChild={true}>@@ -188,22 +190,24 @@ export const replaceTracebackFilenames = (domNode: DOMNode) => {cellId={info.cellId}lineNumber={info.lineNumber}/>- <Tooltip content={tooltipContent}>- <button- type="button"- className="ml-1 p-1 rounded-sm hover:bg-muted transition-all inline"- >- <BugPlayIcon- onClick={() => {- const view = getCellEditorView(info.cellId);- if (view) {- insertDebuggerAtLine(view, info.lineNumber);- }- }}- className="h-3 w-3"- />- </button>- </Tooltip>+ {!isWasm() && (+ <Tooltip content={tooltipContent}>+ <button+ type="button"+ className="ml-1 p-1 rounded-sm hover:bg-muted transition-all inline"+ >+ <BugPlayIcon+ onClick={() => {+ const view = getCellEditorView(info.cellId);+ if (view) {+ insertDebuggerAtLine(view, info.lineNumber);+ }+ }}+ className="h-3 w-3"+ />+ </button>+ </Tooltip>+ )}</span></span>);diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.tsindex 427dbd3339..3f143ab996 100644--- a/frontend/src/core/cells/cells.ts+++ b/frontend/src/core/cells/cells.ts@@ -1088,10 +1088,10 @@ const {// Find the start/end of the collapsed rangesconst nodes = [...column.nodes];- const rangeIndexes: {+ const rangeIndexes: Array<{start: CellIndex;end: CellIndex;- }[] = [];+ }> = [];const reversedCollapseRanges = [];// Iterate in reverse order (bottom-up) to process children firstdiff --git a/frontend/src/core/codemirror/completion/utils.ts b/frontend/src/core/codemirror/completion/utils.tsindex 6a809de0e4..a86ecc1ed0 100644--- a/frontend/src/core/codemirror/completion/utils.ts+++ b/frontend/src/core/codemirror/completion/utils.ts@@ -1,3 +1,4 @@+/* Copyright 2024 Marimo. All rights reserved. */import type { CompletionSource } from "@codemirror/autocomplete";/**diff --git a/frontend/src/core/islands/bridge.ts b/frontend/src/core/islands/bridge.tsindex 418227bfd6..be4e0d4c85 100644--- a/frontend/src/core/islands/bridge.ts+++ b/frontend/src/core/islands/bridge.ts@@ -148,6 +148,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {previewSQLTableList = throwNotImplemented;openFile = throwNotImplemented;sendListFiles = throwNotImplemented;+ sendPdb = throwNotImplemented;sendCreateFileOrFolder = throwNotImplemented;sendDeleteFileOrFolder = throwNotImplemented;sendRenameFileOrFolder = throwNotImplemented;diff --git a/frontend/src/core/network/requests-network.ts b/frontend/src/core/network/requests-network.tsindex 5166594c51..d29f64c2ad 100644--- a/frontend/src/core/network/requests-network.ts+++ b/frontend/src/core/network/requests-network.ts@@ -184,6 +184,13 @@ export function createNetworkRequests(): EditRequests & RunRequests {getUsageStats: () => {return marimoClient.GET("/api/usage").then(handleResponse);},+ sendPdb: (request) => {+ return marimoClient+ .POST("/api/kernel/pdb/pm", {+ body: request,+ })+ .then(handleResponseReturnNull);+ },sendListFiles: (request) => {return marimoClient.POST("/api/files/list_files", {diff --git a/frontend/src/core/network/requests-static.ts b/frontend/src/core/network/requests-static.tsindex 10fa998f78..4564cb23ee 100644--- a/frontend/src/core/network/requests-static.ts+++ b/frontend/src/core/network/requests-static.ts@@ -55,6 +55,7 @@ export function createStaticRequests(): EditRequests & RunRequests {openFile: throwNotInEditMode,getUsageStats: throwNotInEditMode,sendListFiles: throwNotInEditMode,+ sendPdb: throwNotInEditMode,sendCreateFileOrFolder: throwNotInEditMode,sendDeleteFileOrFolder: throwNotInEditMode,sendRenameFileOrFolder: throwNotInEditMode,diff --git a/frontend/src/core/network/requests-toasting.ts b/frontend/src/core/network/requests-toasting.tsindex 93c3765c39..f2bcda5601 100644--- a/frontend/src/core/network/requests-toasting.ts+++ b/frontend/src/core/network/requests-toasting.ts@@ -36,6 +36,7 @@ export function createErrorToastingRequests(openFile: "Failed to open file",getUsageStats: "", // No toastsendListFiles: "Failed to list files",+ sendPdb: "Failed to start debug session",sendCreateFileOrFolder: "Failed to create file or folder",sendDeleteFileOrFolder: "Failed to delete file or folder",sendRenameFileOrFolder: "Failed to rename file or folder",diff --git a/frontend/src/core/network/requests.ts b/frontend/src/core/network/requests.tsindex bcbd0b611e..20a14e347b 100644--- a/frontend/src/core/network/requests.ts+++ b/frontend/src/core/network/requests.ts@@ -53,6 +53,7 @@ export const {previewSQLTableList,openFile,getUsageStats,+ sendPdb,sendListFiles,sendCreateFileOrFolder,sendDeleteFileOrFolder,diff --git a/frontend/src/core/network/types.ts b/frontend/src/core/network/types.tsindex ab1763d555..e7627d1869 100644--- a/frontend/src/core/network/types.ts+++ b/frontend/src/core/network/types.ts@@ -55,6 +55,7 @@ export type PreviewDatasetColumnRequest =schemas["PreviewDatasetColumnRequest"];export type PreviewSQLTableRequest = schemas["PreviewSQLTableRequest"];export type PreviewSQLTableListRequest = schemas["PreviewSQLTableListRequest"];+export type PdbRequest = schemas["PdbRequest"];export type ReadCodeResponse = schemas["ReadCodeResponse"];export type RecentFilesResponse = schemas["RecentFilesResponse"];export type RenameFileRequest = schemas["RenameFileRequest"];@@ -127,6 +128,8 @@ export interface EditRequests {previewSQLTableList: (request: PreviewSQLTableListRequest) => Promise<null>;openFile: (request: { path: string }) => Promise<null>;getUsageStats: () => Promise<UsageResponse>;+ // Debugger+ sendPdb: (request: PdbRequest) => Promise<null>;// File explorer requestssendListFiles: (request: FileListRequest) => Promise<FileListResponse>;sendCreateFileOrFolder: (diff --git a/frontend/src/core/wasm/bridge.ts b/frontend/src/core/wasm/bridge.tsindex 3a694b25f6..15958ac495 100644--- a/frontend/src/core/wasm/bridge.ts+++ b/frontend/src/core/wasm/bridge.ts@@ -234,6 +234,10 @@ export class PyodideBridge implements RunRequests, EditRequests {return null;};+ sendPdb: EditRequests["sendPdb"] = async () => {+ throwNotImplemented();+ };+sendRun: EditRequests["sendRun"] = async (request) => {await this.rpc.proxy.request.loadPackages(request.codes.join("\n"));diff --git a/frontend/src/utils/id-tree.tsx b/frontend/src/utils/id-tree.tsxindex d661d729e5..1905aa9768 100644--- a/frontend/src/utils/id-tree.tsx+++ b/frontend/src/utils/id-tree.tsx@@ -290,7 +290,7 @@ export class CollapsibleTree<T> {* Does not collapse the children of already collapsed nodes*/collapseAll(- collapseRanges: ({ id: T; until: T | undefined } | null)[],+ collapseRanges: Array<{ id: T; until: T | undefined } | null>,): CollapsibleTree<T> {const nodes = [...this.nodes];if (collapseRanges.length === 0) {diff --git a/marimo/_cli/development/commands.py b/marimo/_cli/development/commands.pyindex 139957425e..ef3fbfdd31 100644--- a/marimo/_cli/development/commands.py+++ b/marimo/_cli/development/commands.py@@ -192,10 +192,11 @@ def _generate_server_api_schema() -> dict[str, Any]:requests.ExecutionRequest,requests.FunctionCallRequest,requests.InstallMissingPackagesRequest,+ requests.ListSecretKeysRequest,+ requests.PdbRequest,requests.PreviewDatasetColumnRequest,- requests.PreviewSQLTableRequest,requests.PreviewSQLTableListRequest,- requests.ListSecretKeysRequest,+ requests.PreviewSQLTableRequest,requests.RenameRequest,requests.SetCellConfigRequest,requests.SetUserConfigRequest,diff --git a/marimo/_runtime/marimo_pdb.py b/marimo/_runtime/marimo_pdb.pyindex 84e89ee8fb..0a4faead76 100644--- a/marimo/_runtime/marimo_pdb.py+++ b/marimo/_runtime/marimo_pdb.py@@ -4,13 +4,15 @@ from __future__ import annotationsimport inspectimport sysfrom pdb import Pdb-from typing import TYPE_CHECKING, Any+from typing import TYPE_CHECKING, Any, Optionalfrom marimo import _loggersfrom marimo._messaging.types import Stdin, Stdoutif TYPE_CHECKING:- from types import FrameType+ from types import FrameType, TracebackType++ from marimo._types.ids import CellId_tLOGGER = _loggers.marimo_logger()@@ -38,6 +40,11 @@ class MarimoPdb(Pdb):# it anyway -- stdin is fine too ...self.use_rawinput = stdin is None+ # Some custom attributes to hold on to exception data from cell+ # evaluation.+ self._last_tracebacks: dict[CellId_t, TracebackType] = {}+ self._last_traceback: Optional[TracebackType] = None+def set_trace(self, frame: FrameType | None = None, header: str | None = None) -> None:@@ -45,6 +52,25 @@ class MarimoPdb(Pdb):sys.stdout.write(header)return super().set_trace(frame)+ def post_mortem_by_cell_id(self, cell_id: CellId_t) -> None:+ return self.post_mortem(t=self._last_tracebacks.get(cell_id))++ def post_mortem(self, t: Optional[TracebackType] = None) -> None:+ if t is None:+ t = self._last_traceback++ # Language and behavior copied from cpython.+ if t is None or (+ isinstance(t, BaseException) and t.__traceback__ is None+ ):+ raise ValueError(+ "A valid traceback must be passed if no "+ "exception is being handled"+ )++ self.reset()+ self.interaction(None, t)+def set_trace(debugger: MarimoPdb,diff --git a/marimo/_runtime/patches.py b/marimo/_runtime/patches.pyindex 0ef16b899a..287bea586c 100644--- a/marimo/_runtime/patches.py+++ b/marimo/_runtime/patches.py@@ -27,6 +27,9 @@ def patch_pdb(debugger: marimo_pdb.MarimoPdb) -> None:pdb.Pdb = marimo_pdb.MarimoPdb # type: ignore[misc, assignment]pdb.set_trace = functools.partial(marimo_pdb.set_trace, debugger=debugger)+ # Used on failure for step through+ pdb.post_mortem = debugger.post_mortem+def patch_webbrowser() -> None:import webbrowserdiff --git a/marimo/_runtime/requests.py b/marimo/_runtime/requests.pyindex 2b17e8e6d5..9a06ee790c 100644--- a/marimo/_runtime/requests.py+++ b/marimo/_runtime/requests.py@@ -119,6 +119,16 @@ class HTTPRequest(Mapping[str, Any]):)+@dataclass+class PdbRequest:+ cell_id: CellId_t+ # incoming request, e.g. from Starlette or FastAPI+ request: Optional[HTTPRequest] = None++ def __repr__(self) -> str:+ return f"PdbRequest(cell={self.cell_id})"++@dataclassclass ExecutionRequest:cell_id: CellId_t@@ -342,21 +352,22 @@ class RefreshSecretsRequest:ControlRequest = Union[+ CreationRequest,+ DeleteCellRequest,ExecuteMultipleRequest,ExecuteScratchpadRequest,ExecuteStaleRequest,- CreationRequest,- DeleteCellRequest,FunctionCallRequest,- RenameRequest,- SetCellConfigRequest,- SetUserConfigRequest,- SetUIElementValueRequest,- StopRequest,InstallMissingPackagesRequest,+ ListSecretKeysRequest,+ PdbRequest,PreviewDatasetColumnRequest,- PreviewSQLTableRequest,PreviewSQLTableListRequest,- ListSecretKeysRequest,+ PreviewSQLTableRequest,RefreshSecretsRequest,+ RenameRequest,+ SetCellConfigRequest,+ SetUIElementValueRequest,+ SetUserConfigRequest,+ StopRequest,]diff --git a/marimo/_runtime/runner/cell_runner.py b/marimo/_runtime/runner/cell_runner.pyindex 5594872564..2f8c516a0e 100644--- a/marimo/_runtime/runner/cell_runner.py+++ b/marimo/_runtime/runner/cell_runner.py@@ -10,6 +10,7 @@ import threadingimport tracebackfrom dataclasses import dataclassfrom pathlib import Path+from types import TracebackTypefrom typing import TYPE_CHECKING, Any, Callable, Optional, Unionfrom marimo._ast.cell import CellImpl@@ -324,6 +325,10 @@ class Runner:async def run(self, cell_id: CellId_t) -> RunResult:"""Run a cell."""+ if self.debugger is not None:+ last_tb = self.debugger._last_tracebacks.pop(cell_id, None)+ if last_tb == self.debugger._last_traceback:+ self.debugger._last_traceback = Nonecell = self.graph.cells[cell_id]try:@@ -508,12 +513,20 @@ class Runner:try:# Bdb defines the botframe attribute and sets it to non-None# when it starts up- if (- self.debugger is not None- and hasattr(self.debugger, "botframe")- and self.debugger.botframe is not None- ):- self.debugger.set_continue()+ if self.debugger is not None:+ if (+ hasattr(self.debugger, "botframe")+ and self.debugger.botframe is not None+ ):+ self.debugger.set_continue()+ # Hold on to this information for debugging postmortem etc.+ if run_result.exception is not None and hasattr(+ run_result.exception, "__traceback__"+ ):+ tb = run_result.exception.__traceback__+ assert isinstance(tb, TracebackType)+ self.debugger._last_traceback = tb+ self.debugger._last_tracebacks[cell_id] = tbexcept Exception as debugger_error:# This has never been hit, but just in case -- don't want# to crash the kernel.diff --git a/marimo/_runtime/runtime.py b/marimo/_runtime/runtime.pyindex 30639d5ea4..4a0d9ecdae 100644--- a/marimo/_runtime/runtime.py+++ b/marimo/_runtime/runtime.py@@ -124,6 +124,7 @@ from marimo._runtime.requests import (FunctionCallRequest,InstallMissingPackagesRequest,ListSecretKeysRequest,+ PdbRequest,PreviewDatasetColumnRequest,PreviewSQLTableListRequest,PreviewSQLTableRequest,@@ -1537,6 +1538,18 @@ class Kernel:await _run_with_uninstantiated_requests(filtered_requests)+ @kernel_tracer.start_as_current_span("pdb_request")+ async def pdb_request(self, cell_id: CellId_t) -> None:+ if (+ self.debugger is None+ or cell_id not in self.debugger._last_tracebacks+ or cell_id not in self.graph.cells+ ):+ return++ with self._install_execution_context(cell_id):+ self.debugger.post_mortem_by_cell_id(cell_id)+@kernel_tracer.start_as_current_span("rename_file")async def rename_file(self, filename: str) -> None:self.globals["__file__"] = filename@@ -2013,6 +2026,9 @@ class Kernel:await self.set_ui_element_value(request)CompletedRun().broadcast()+ async def handle_pdb_request(request: PdbRequest) -> None:+ await self.pdb_request(request.cell_id)+async def handle_rename(request: RenameRequest) -> None:await self.rename_file(request.filename)@@ -2041,18 +2057,19 @@ class Kernel:return Nonehandler.register(CreationRequest, handle_instantiate)+ handler.register(DeleteCellRequest, self.delete_cell)handler.register(ExecuteMultipleRequest, handle_execute_multiple)handler.register(ExecuteScratchpadRequest, handle_execute_scratchpad)handler.register(ExecuteStaleRequest, handle_execute_stale)- handler.register(RenameRequest, handle_rename)- handler.register(SetCellConfigRequest, self.set_cell_config)- handler.register(SetUserConfigRequest, handle_set_user_config)- handler.register(SetUIElementValueRequest, handle_set_ui_element_value)handler.register(FunctionCallRequest, handle_function_call)- handler.register(DeleteCellRequest, self.delete_cell)handler.register(InstallMissingPackagesRequest, handle_install_missing_packages)+ handler.register(PdbRequest, handle_pdb_request)+ handler.register(RenameRequest, handle_rename)+ handler.register(SetCellConfigRequest, self.set_cell_config)+ handler.register(SetUIElementValueRequest, handle_set_ui_element_value)+ handler.register(SetUserConfigRequest, handle_set_user_config)handler.register(StopRequest, handle_stop)# Datasetshandler.register(diff --git a/marimo/_server/api/endpoints/execution.py b/marimo/_server/api/endpoints/execution.pyindex fde1612b23..bf56b1f7de 100644--- a/marimo/_server/api/endpoints/execution.py+++ b/marimo/_server/api/endpoints/execution.py@@ -14,6 +14,7 @@ from marimo._runtime.requests import (ExecuteScratchpadRequest,FunctionCallRequest,HTTPRequest,+ PdbRequest,SetUIElementValueRequest,)from marimo._server.api.deps import AppState@@ -214,6 +215,36 @@ async def run_scratchpad(return SuccessResponse()[email protected]("/pdb/pm")+@requires("edit")+async def run_post_mortem(+ *,+ request: Request,+) -> BaseResponse:+ """+ requestBody:+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/PdbRequest"+ responses:+ 200:+ description: Run a post mortem on the most recent failed cell.+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/SuccessResponse"+ """ # noqa: E501+ app_state = AppState(request)+ body = await parse_request(request, cls=PdbRequest)+ app_state.require_current_session().put_control_request(+ body,+ from_consumer_id=ConsumerId(app_state.require_current_session_id()),+ )++ return SuccessResponse()++@router.post("/restart_session")@requires("edit")async def restart_session(diff --git a/openapi/api.yaml b/openapi/api.yamlindex 3d84e30b14..33ff05faa8 100644--- a/openapi/api.yaml+++ b/openapi/api.yaml@@ -1838,6 +1838,16 @@ components:required:- successtype: object+ PdbRequest:+ properties:+ cellId:+ type: string+ request:+ $ref: '#/components/schemas/HTTPRequest'+ nullable: true+ required:+ - cellId+ type: objectPreviewDatasetColumnRequest:properties:columnName:@@ -2502,7 +2512,7 @@ components:type: objectinfo:title: marimo API- version: 0.13.3+ version: 0.13.4openapi: 3.1.0paths:/@file/{filename_and_length}:@@ -2977,6 +2987,20 @@ paths:schema:$ref: '#/components/schemas/SuccessResponse'description: Interrupt the kernel's execution+ /api/kernel/pdb/pm:+ post:+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/PdbRequest'+ responses:+ 200:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/SuccessResponse'+ description: Run a post mortem on the most recent failed cell./api/kernel/read_code:post:responses:diff --git a/openapi/src/api.ts b/openapi/src/api.tsindex b5b0e72983..b95e4f57a5 100644--- a/openapi/src/api.ts+++ b/openapi/src/api.ts@@ -1357,6 +1357,45 @@ export interface paths {patch?: never;trace?: never;};+ "/api/kernel/pdb/pm": {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ get?: never;+ put?: never;+ post: {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ requestBody?: {+ content: {+ "application/json": components["schemas"]["PdbRequest"];+ };+ };+ responses: {+ /** @description Run a post mortem on the most recent failed cell. */+ 200: {+ headers: {+ [name: string]: unknown;+ };+ content: {+ "application/json": components["schemas"]["SuccessResponse"];+ };+ };+ };+ };+ delete?: never;+ options?: never;+ head?: never;+ patch?: never;+ trace?: never;+ };"/api/kernel/read_code": {parameters: {query?: never;@@ -3124,6 +3163,10 @@ export interface components {error?: string | null;success: boolean;};+ PdbRequest: {+ cellId: string;+ request?: components["schemas"]["HTTPRequest"];+ };PreviewDatasetColumnRequest: {columnName: string;fullyQualifiedTableName?: string | null;diff --git a/tests/_runtime/runner/test_cell_runner.py b/tests/_runtime/runner/test_cell_runner.pyindex 8e30da1861..3151394135 100644--- a/tests/_runtime/runner/test_cell_runner.py+++ b/tests/_runtime/runner/test_cell_runner.py@@ -1,4 +1,6 @@# Copyright 2024 Marimo. All rights reserved.+import traceback+from marimo._runtime.capture import capture_stderrfrom marimo._runtime.runner.cell_runner import Runnerfrom marimo._runtime.runtime import Kernel@@ -21,6 +23,7 @@ async def test_cell_output(run_result = await runner.run(er.cell_id)# last expression of cell is outputassert run_result.output == 123+ assert k.debugger._last_traceback is Noneasync def test_traceback_includes_lineno(@@ -33,11 +36,12 @@ async def test_traceback_includes_lineno(# first run the cell to populate the graphawait k.run([- er := exec_req.get(+ er := exec_req.get_with_id(+ "1","""x = 0raise ValueError- """+ """,)])@@ -51,6 +55,11 @@ async def test_traceback_includes_lineno(with capture_stderr() as buffer:await runner.run(er.cell_id)assert "line 3" in buffer.getvalue()+ assert k.debugger._last_traceback == k.debugger._last_tracebacks["1"]+ assert k.debugger._last_traceback is not None+ assert "line 3" in "\n".join(+ traceback.format_tb(k.debugger._last_traceback)+ )async def test_base_exception_caught(@@ -65,11 +74,12 @@ async def test_base_exception_caught(# first run the cell to populate the graphawait k.run([- er := exec_req.get(+ er := exec_req.get_with_id(+ "1","""x = 0raise BaseException- """+ """,)])@@ -83,3 +93,8 @@ async def test_base_exception_caught(with capture_stderr() as buffer:await runner.run(er.cell_id)assert "line 3" in buffer.getvalue()+ assert k.debugger._last_traceback == k.debugger._last_tracebacks["1"]+ assert k.debugger._last_traceback is not None+ assert "line 3" in "\n".join(+ traceback.format_tb(k.debugger._last_traceback)+ )