[issue13177] Avoid chained exceptions in lru_cache
Eric Snow
report at bugs.python.org
Fri Oct 14 22:05:14 CEST 2011
Eric Snow <ericsnowcurrently at gmail.com> added the comment:
Could you just cancel the chained exception?
>>> try: {}["asdf"]
... except KeyError:
... try: raise Exception()
... except Exception as x:
... x.__cause__ = None
... x.__context__ = None
... x.__traceback__ = None
... raise x
...
Traceback (most recent call last):
File "<stdin>", line 8, in <module>
Exception
in contrast to:
>>> try: {}["asdf"]
... except KeyError:
... try: raise e
... except Exception as x:
... raise x
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'asdf'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "<stdin>", line 3, in <module>
File "<stdin>", line 8, in <module>
Exception
----------
nosy: +eric.snow
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13177>
_______________________________________
More information about the Python-bugs-list
mailing list