Skip to content

Commit

Permalink
Merge pull request from GHSA-h56g-gq9v-vc8r
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
  • Loading branch information
minrk and blink1073 authored Dec 4, 2023
1 parent 88eca99 commit 0056c3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 3 additions & 2 deletions jupyter_server/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import mimetypes
import os
import re
import traceback
import types
import warnings
from http.client import responses
Expand Down Expand Up @@ -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))

Expand Down
4 changes: 1 addition & 3 deletions jupyter_server/services/kernels/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 0056c3a

Please sign in to comment.