- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
Issue14655
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012-04-23 21:22 by r.david.murray, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg159084 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2012-04-23 21:22 | |
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. |
|||
| msg159091 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * ![]() |
Date: 2012-04-23 22:08 | |
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). |
|||
| msg159102 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2012-04-23 23:36 | |
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. |
|||
| msg380338 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2020-11-04 16:23 | |
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(). |
|||
| msg384659 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2021-01-08 13:12 | |
In issue 26389 the api was changed so that now format_exception(exc) works. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:29 | admin | set | github: 58860 |
| 2021-01-08 13:12:48 | iritkatriel | set | status: open -> closed superseder: Expand traceback module API to accept just an exception as an argument messages: + msg384659 resolution: duplicate stage: needs patch -> resolved |
| 2020-11-04 16:23:03 | iritkatriel | set | versions:
+ Python 3.8, Python 3.9, Python 3.10, - Python 2.7, Python 3.2, Python 3.3 nosy: + iritkatriel, docs@python messages: + msg380338 assignee: docs@python components: + Documentation |
| 2012-04-24 05:02:06 | Arfrever | set | nosy:
+ Arfrever |
| 2012-04-23 23:36:49 | r.david.murray | set | messages: + msg159102 |
| 2012-04-23 22:08:45 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg159091 |
| 2012-04-23 21:22:51 | r.david.murray | create | |


