[issue10805] traceback.print_exception throws AttributeError when exception is None
Claudiu Popa added the comment: This was recently fixed in 3.5 by 73afda5a4e4c. -- nosy: +Claudiu.Popa resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10805 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10805] traceback.print_exception throws AttributeError when exception is None
Giovanni Funchal gafunc...@gmail.com added the comment: This bug affects me, found it when migrating from 2.7 to 3.2, in a function calling traceback.print_exc() called while there were no active exception being handled. Previous behavior was to print None. -- nosy: +Giovanni.Funchal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10805] traceback.print_exception throws AttributeError when exception is None
Boris FELD lothiral...@gmail.com added the comment: I add a test to test_traceback.py for this bug. Bug is confirmed on python 3.2 and python3.3. I use 2.x behavior as reference. I don't know if we should add an assertion in traceback.print_exception or traceback._iter_chain, so I add the test for traceback.print_exception. -- keywords: +patch nosy: +Boris.FELD Added file: http://bugs.python.org/file24011/new_traceback_test_print_traceback.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10805] traceback.print_exception throws AttributeError when exception is None
Antoine Pitrou pit...@free.fr added the comment: Well, under 2.x, print_traceback(None, None, None) would just print None, but I'm not sure that's a supported use case. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10805] traceback.print_exception throws AttributeError when exception is None
New submission from Austin Bingham austin.bing...@gmail.com: 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 rep...@bugs.python.org http://bugs.python.org/issue10805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10805] traceback.print_exception throws AttributeError when exception is None
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +pitrou versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com