Skip to content

Commit

Permalink
fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel committed Apr 14, 2022
1 parent 991e982 commit 602b4c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
52 changes: 26 additions & 26 deletions Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2194,32 +2194,32 @@ def some_inner():
[f'{__file__}:{some_inner.__code__.co_firstlineno + 1}'])

def test_dropping_frames(self):
def f():
1/0

def g():
try:
f()
except:
return sys.exc_info()

exc_info = g()

class Skip_G(traceback.StackSummary):
def format_frame_summary(self, frame_summary):
if frame_summary.name == 'g':
return None
return super().format_frame_summary(frame_summary)

stack = Skip_G.extract(
traceback.walk_tb(exc_info[2])).format()

self.assertEqual(len(stack), 1)
lno = f.__code__.co_firstlineno + 1
self.assertEqual(
stack[0],
f' File "{__file__}", line {lno}, in f\n 1/0\n'
)
def f():
1/0

def g():
try:
f()
except:
return sys.exc_info()

exc_info = g()

class Skip_G(traceback.StackSummary):
def format_frame_summary(self, frame_summary):
if frame_summary.name == 'g':
return None
return super().format_frame_summary(frame_summary)

stack = Skip_G.extract(
traceback.walk_tb(exc_info[2])).format()

self.assertEqual(len(stack), 1)
lno = f.__code__.co_firstlineno + 1
self.assertEqual(
stack[0],
f' File "{__file__}", line {lno}, in f\n 1/0\n'
)


class TestTracebackException(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Lib/traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ def format(self, *, chain=True, _ctx=None):
# format exception group
is_toplevel = (_ctx.exception_group_depth == 0)
if is_toplevel:
_ctx.exception_group_depth += 1
_ctx.exception_group_depth += 1

if exc.stack:
yield from _ctx.emit(
Expand Down

0 comments on commit 602b4c4

Please sign in to comment.