Skip to content

Commit

Permalink
Handle an Exception without a traceback.
Browse files Browse the repository at this point in the history
When an exception does not have a traceback there are no frames
to filter, but there's an explicit check for the last frame which
will fail if there are no frames.

An example exception with this problem can be seen when using
concurrent.futures.ProcessPoolExecutor.  When it reconstitutes a
remote exception it has serialized the traceback to a string it
includes as the error message instead of an object that can be
inspected.
  • Loading branch information
kjurka committed Oct 3, 2021
1 parent fb7ddd8 commit b397c96
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/werkzeug/debug/tbtools.py
Expand Up @@ -357,6 +357,10 @@ def __init__(
tb = tb.tb_next # type: ignore

def filter_hidden_frames(self) -> None:
# If we don't have any frames to start with, there's nothing to filter
if not self.frames:
return

new_frames: t.List[Frame] = []
hidden = False

Expand Down

0 comments on commit b397c96

Please sign in to comment.