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 pitrou
Recipients amaury.forgeotdarc, ddvoinikov, georg.brandl, pitrou
Date 2008-05-14.09:21:29
SpamBayes Score 0.009003344
Marked as misclassified No
Message-id <1210756897.71.0.60267819375.issue2833@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-05-14 09:21:39pitrousetspambayes_score: 0.00900334 -> 0.009003344
recipients: + pitrou, georg.brandl, amaury.forgeotdarc, ddvoinikov
2008-05-14 09:21:37pitrousetspambayes_score: 0.00900334 -> 0.00900334
messageid: <1210756897.71.0.60267819375.issue2833@psf.upfronthosting.co.za>
2008-05-14 09:21:36pitroulinkissue2833 messages
2008-05-14 09:21:34pitroucreate