[New-bugs-announce] [issue14655] traceback module docs should show how to print/fomat an exception object

R. David Murray report at bugs.python.org
Mon Apr 23 23:22:52 CEST 2012


New submission from R. David Murray <rdmurray at bitdance.com>:

Suppose you have an exception object acquired from somewhere.  The exception is no longer active on the stack.  Now you want to format the exception like format_exception would (to log it, perhaps).  To do this you apparently need to call:

  format_exception(type(exc), exc, exc.__traceback__)

This seems redundant, so it would be nice to have a simpler call.  Too bad the name format_exception is already taken.  But, leaving that aside, the above is not documented in the traceback module.  The last example shows the (type(exc), exc) call form for format_exception_only, but that's as close as it gets.

----------
messages: 159084
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: traceback module docs should show how to print/fomat an exception object
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14655>
_______________________________________


More information about the New-bugs-announce mailing list