Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-shields committed Feb 9, 2024
1 parent 5df87bd commit 1d1ba0b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/uberjob/_util/traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ def __repr__(self):
)


TruncatedStackFrame = None


class TruncatedStackFrameType:
def __repr__(self):
return "TruncatedStackFrame"

def __new__(cls, *args, **kwargs):
if TruncatedStackFrame is not None:
return TruncatedStackFrame
return super().__new__(cls, *args, **kwargs)


TruncatedStackFrame = TruncatedStackFrameType()

Expand Down Expand Up @@ -81,7 +89,7 @@ def recurse(frame, depth):
def render_symbolic_traceback(stack_frame):
stack_frames = []
while stack_frame:
if type(stack_frame) is TruncatedStackFrameType:
if stack_frame is TruncatedStackFrame:
stack_frames.append(stack_frame)
break
if "/IPython/core/" in stack_frame.path:
Expand All @@ -90,7 +98,7 @@ def render_symbolic_traceback(stack_frame):
stack_frame = stack_frame.outer

def format_stack_frame(s):
if type(s) is TruncatedStackFrameType:
if s is TruncatedStackFrame:
return " ... truncated"
return f' File "{s.path}", line {s.line}, in {s.name}'

Expand Down

0 comments on commit 1d1ba0b

Please sign in to comment.