Closed
Description
Documentation
Some change in Python 3.13 (maybe 5f3433f or related) allows pdb.post_mortem()
to accept an exception object, as well as a traceback object. This could be useful to use for chained exception access, for example in Django’s test runner where a traceback is currently passed, but the exception with chained causes is available.
Tested with:
import pdb
try:
try:
1 / 0
except Exception:
2 / 0
except Exception as exc:
pdb.post_mortem(exc)
and ran with:
$ uv run -p 3.13 python example.py
> /.../example.py(7)<module>()
-> 2 / 0
(Pdb) exceptions
0 ZeroDivisionError('division by zero')
> 1 ZeroDivisionError('division by zero')
(Pdb) exceptions 0
> /.../example.py(5)<module>()
-> 1 / 0
(Pdb)
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Todo