Add traceback.TracebackException.__traceback__ #111918
Labels
3.13
bugs and security fixes
stdlib
Python modules in the Lib dir
type-feature
A feature request or enhancement
Feature or enhancement
The traceback object passed to
traceback.TracebackException
is converted toStackSummary
object. That is exposed as thestack
attribute of the newTracebackException
object.I'd like to also expose that as
__traceback__
. Why? To allowTracebackException
to work better as a drop-in replacement proxy for an exception object.__traceback__
is the only standard exception attribute that is not found onTracebackException
.This does imply that we may also want
StackSummary
/FrameSummary
to likewise work as a drop-in replacement fortypes.TracebackType
. For some prior discussion about that, see #74764 (comment).(FWIW, I didn't find any discussion on why
__traceback__
wasn't added when all the other exception attributes were. I'm guessing it was an oversight, falling outside theTracebackException
use cases people were thinking about at the time.)The text was updated successfully, but these errors were encountered: