[issue3112] implement PEP 3134 exception reporting
Antoine Pitrou
report at bugs.python.org
Sat Jun 14 22:47:02 CEST 2008
Antoine Pitrou <pitrou at free.fr> added the comment:
Thinking about this, I realized that an exception can become its own
context if it is explicitly re-raised in its except handler (with "raise
variable", not bare "raise").
Not a critical bug, but it should be fixed in order to avoid delayed
garbage collection of such exceptions.
(as for the exception reporting code, it will have to detect recursivity)
>>> try: 1/0
... except Exception as e: raise e
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<stdin>", line 1, in <module>
ZeroDivisionError: int division or modulo by zero
>>> e = sys.last_value
>>> e.__context__
ZeroDivisionError('int division or modulo by zero',)
>>> e.__context__ is e
True
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3112>
_______________________________________
More information about the Python-bugs-list
mailing list