[Python-Dev] RELEASED Python 2.5 (alpha 1)

Phillip J. Eby pje at telecommunity.com
Thu Apr 6 01:01:13 CEST 2006


At 03:29 PM 4/5/2006, Delaney, Timothy (Tim) wrote:
>Anthony Baxter wrote:
>
> > On behalf of the Python development team and the Python
> > community, I'm happy to announce the first alpha release
> > of Python 2.5.
>
>I noticed in PEP 356 Open Issues "StopIteration should propagate from
>context managers" that there's a still a question (from Jim Jewett)
>about whether the fix is correct.
>
>We'll need to get confirmation from PJE, but I'm pretty sure this can be
>removed from open issues - returning False from __exit__ will result in
>the original exception being re-raised.

It is correct, and for the reason you describe.  __exit__ *must* 
return True or False unless the generator raises a new, 
non-StopIteration exception.  All other exceptions must be swallowed 
in __exit__.




More information about the Python-Dev mailing list