﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36057	Make `test --pdb` pass exception to `pdb.post_mortem()` on Python 3.13	Adam Johnson	Adam Johnson	"Python 3.13 added support for navigating between chained exceptions in pdb with [https://docs.python.org/3.14/library/pdb.html#pdbcommand-exceptions the new 'exceptions' command].

Currently, using `test --pdb` does not allow this navigation, failing with this message:

{{{
(Pdb) exceptions
Did not find chained exceptions. To move between exceptions, pdb/post_mortem must be given an exception object rather than a traceback.
}}}

`PDBDebugResult` currently passes `pdb.post_mortem()`  the traceback object. But it turns out that the pdb changes in 3.13 also allow passing an exception here, which is currently undocumented but I [https://github.com/python/cpython/pull/128410 submitted a PR].

If we switch to passing the exception, it enables switching between chained exceptions:

{{{
> /.../django/core/management/commands/dumpdata.py(285)handle()
-> raise CommandError(""Unable to serialize database: %s"" % e)
(Pdb) exceptions
    0 TypeError(""string argument expected, got 'bytes'"")
>   1 CommandError(""Unable to serialize database: string argument expected, got 'by...
(Pdb) exceptions 0
> /.../django/core/management/base.py(181)write()
-> self._out.write(style_func(msg))
(Pdb)
}}}

(I actually made this change to debug a chained exception failure whilst working on #36056.)"	New feature	closed	Testing framework	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
