New submission from Austin Bingham <[email protected]>:
traceback.print_exception() will throw an AttributeException if `value` is None
and `chain` is True. This is because `_iter_chain` assumes that the exception
object has a `__cause__` attribute. You can trigger this by trying for format a
non-existent exception:
>>> import logging, sys
>>> logging.Formatter().formatException(sys.exc_info())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.1/logging/__init__.py", line 418, in formatException
traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
File "/usr/lib/python3.1/traceback.py", line 155, in print_exception
for value, tb in values:
File "/usr/lib/python3.1/traceback.py", line 122, in _iter_chain
cause = exc.__cause__
This is assuming that sys.exc_info() returns (None, None, None).
----------
components: Library (Lib)
messages: 125054
nosy: abingham
priority: normal
severity: normal
status: open
title: traceback.print_exception throws AttributeError when exception is None
type: behavior
versions: Python 3.1
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10805>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com