Implement the chain= argument of traceback.print_exception · MicroPythonNexus/circuitpython@b83c42e · GitHub
Skip to content

Commit b83c42e

Browse files
committed
Implement the chain= argument of traceback.print_exception
1 parent 6e40949 commit b83c42e

3 files changed

Lines changed: 31 additions & 14 deletions

File tree

shared-bindings/traceback/__init__.c

Lines changed: 16 additions & 6 deletions

tests/circuitpython/traceback_test_chained.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
raise SystemExit
1212

1313

14-
def print_exc_info(e):
14+
def print_exc_info(e, chain=True):
1515
print("-" * 72)
16-
traceback.print_exception(None, e, e.__traceback__)
16+
traceback.print_exception(None, e, e.__traceback__, chain=chain)
1717
print("-" * 72)
1818
print()
1919

@@ -24,6 +24,7 @@ def print_exc_info(e):
2424
except Exception as inner:
2525
raise RuntimeError() from inner
2626
except Exception as e:
27+
print_exc_info(e, chain=False)
2728
print_exc_info(e)
2829
print()
2930

tests/circuitpython/traceback_test_chained.py.exp

Lines changed: 12 additions & 6 deletions

0 commit comments

Comments
 (0)