Antoine Pitrou <[EMAIL PROTECTED]> added the comment: As Amaury said, lexically nested exception handlers make re-raising behaviour buggy. In Py3k, a workaround is to instead write:
try: raise Exception("foo") except Exception as : try: raise KeyError("caught") except KeyError: pass raise e With the slight inconvenience that the "raise e" line will be appended to the original traceback. If we want bare "raise" statements to work as expected after a nested exception handler, we'll need to add proper exception stacking, for example by adding the exception value as a member of PyTryBlock. The effect on performance should also be measured. __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2833> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com