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__.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to