diff --git a/jupyter_server/base/handlers.py b/jupyter_server/base/handlers.py index e6e6b3246e..b1b783cca9 100644 --- a/jupyter_server/base/handlers.py +++ b/jupyter_server/base/handlers.py @@ -10,7 +10,6 @@ import mimetypes import os import re -import traceback import types import warnings from http.client import responses @@ -748,7 +747,9 @@ def write_error(self, status_code: int, **kwargs: Any) -> None: else: reply["message"] = "Unhandled error" reply["reason"] = None - reply["traceback"] = "".join(traceback.format_exception(*exc_info)) + # backward-compatibility: traceback field is present, + # but always empty + reply["traceback"] = "" self.log.warning("wrote error: %r", reply["message"], exc_info=True) self.finish(json.dumps(reply)) diff --git a/jupyter_server/services/kernels/handlers.py b/jupyter_server/services/kernels/handlers.py index 2fb753e93c..217f0c9cc2 100644 --- a/jupyter_server/services/kernels/handlers.py +++ b/jupyter_server/services/kernels/handlers.py @@ -5,7 +5,6 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import json -from traceback import format_tb try: from jupyter_client.jsonutil import json_default @@ -102,8 +101,7 @@ async def post(self, kernel_id, action): except Exception as e: message = "Exception restarting kernel" self.log.error(message, exc_info=True) - traceback = format_tb(e.__traceback__) - self.write(json.dumps({"message": message, "traceback": traceback})) + self.write(json.dumps({"message": message, "traceback": ""})) self.set_status(500) else: model = await ensure_async(km.kernel_model(kernel_id))