MCPcopy Index your code
hub / github.com/python/cpython / leaf_generator

Function leaf_generator

Lib/test/test_exception_group.py:565–577  ·  view source on GitHub ↗
(exc, tbs=None)

Source from the content-addressed store, hash-verified

563
564
565def leaf_generator(exc, tbs=None):
566 if tbs is None:
567 tbs = []
568 tbs.append(exc.__traceback__)
569 if isinstance(exc, BaseExceptionGroup):
570 for e in exc.exceptions:
571 yield from leaf_generator(e, tbs)
572 else:
573 # exc is a leaf exception and its traceback
574 # is the concatenation of the traceback
575 # segments in tbs
576 yield exc, tbs
577 tbs.pop()
578
579
580class LeafGeneratorTest(unittest.TestCase):

Callers 5

test_leaf_generatorMethod · 0.85
split_exception_groupMethod · 0.85
leavesMethod · 0.85
tbs_for_leafMethod · 0.85

Calls 2

appendMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…