This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients eric.snow, ezio.melotti, rhettinger
Date 2011-10-14.20:05:13
SpamBayes Score 0.0014939841
Marked as misclassified No
Message-id <1318622714.39.0.261065297397.issue13177@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-10-14 20:05:14eric.snowsetrecipients: + eric.snow, rhettinger, ezio.melotti
2011-10-14 20:05:14eric.snowsetmessageid: <1318622714.39.0.261065297397.issue13177@psf.upfronthosting.co.za>
2011-10-14 20:05:13eric.snowlinkissue13177 messages
2011-10-14 20:05:13eric.snowcreate