Author jyasskin
Recipients collinwinter, jyasskin
Date 2009-05-08.17:43:58
SpamBayes Score 1.69987e-09
Marked as misclassified No
Message-id <1241804641.35.0.0131164077966.issue5970@psf.upfronthosting.co.za>
In-reply-to
Content
There's an obscure bug in sys.exc_info after a yield statement.

  def test():
      def raising_generator():
          try:
              raise IndexError("inner exception")
          except IndexError:
              yield 3
              # Here, sys.exc_info() ought to refer to the inner
              # exception, but instead it refers to the outer one.
      try:
          raise ValueError("outer exception")
      except ValueError:
          for i in raising_generator(): pass

sys.exc_info gets reset even if there's no outer exception.

The attached (failing) patch highlights this problem, and tests other
sys.exc_info behavior around function calls.
History
Date User Action Args
2009-05-08 17:44:02jyasskinsetrecipients: + jyasskin, collinwinter
2009-05-08 17:44:01jyasskinsetmessageid: <1241804641.35.0.0131164077966.issue5970@psf.upfronthosting.co.za>
2009-05-08 17:44:00jyasskinlinkissue5970 messages
2009-05-08 17:43:59jyasskincreate