Irit Katriel added the comment:
In issue 26389 the api was changed so that now format_exception(exc) works.
--
resolution: -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder: -> Expand traceback module API to accept just an exception as an
argument
Irit Katriel added the comment:
As of 3.5 there is this option:
traceback.TracebackException.from_exception(exc).format()
Perhaps that can be mentioned in the doc for traceback.format_exception().
--
assignee: -> docs@python
components: +Documentation
nosy: +docs@python,
New submission from R. David Murray rdmur...@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
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
Why not reuse format_exception(exc)?
in 2.7 you could write raise type, value, traceback, or raise value.
I suggest that traceback.format_exception take the same route, and accept both
(type, value, traceback) and (value).
--
R. David Murray rdmur...@bitdance.com added the comment:
Sounds OK to me, though I am worried others will think that kind of variable
signature (where the type of the first argument depends on the number of
arguments passed) is bad.
--
___
Python
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14655
___