Eric Snow <ericsnowcurren...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue13177>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to