← index #4667Issue #391
Off-topic · high · value 2.334
QUERY · ISSUE

Print traceback without an exception

openby mzakharocscopened 2019-04-02updated 2019-05-14

Hello, in CPython, there is a way to print a traceback outside of an exception, through traceback.print_stack() function. What would it take to add similar functionality to micropython?

CANDIDATE · ISSUE

Exception chaining not implemented

closedby pfalconopened 2014-03-29updated 2022-12-02

This is mostly for tracking differences from CPython.

Also, can discuss if we need this.

Doc: http://legacy.python.org/dev/peps/pep-3134/

Roughly, raising a new exception (not reraising) when we handle another exception, chains them. But CPython prints them not like Java, but upside down:

Traceback (most recent call last):
  File "try-reraise3.py", line 5, in <module>
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "try-reraise3.py", line 7, in <module>
    raise TypeError
TypeError

(But I guess Python prints traceback in reverse order comparing to java either, so the above behavior would be "natural" (the "most important" info printed last)).

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied