Re: [Python-Dev] SF #1462485 - StopIteration raised in body of 'with' statement suppressed

2006-04-03 Thread Delaney, Timothy (Tim)
Guido van Rossum wrote: >> I can't confirm right now (at work, need to install 2.5) but I'm also >> wondering what will happen if KeyboardInterrupt or SystemExit is >> raised from inside the generator when it's being closed via >> __exit__. I suspect a RuntimeError will be raised, whereas I think

Re: [Python-Dev] SF #1462485 - StopIteration raised in body of 'with' statement suppressed

2006-04-03 Thread Guido van Rossum
On 4/2/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > Given: > > @contextmanager > def gen(): > print '__enter__' > yield > print '__exit__' > > with gen(): > raise StopIteration('body') > > I would expect to get the StopIteration exception raised. Instead it's > suppressed

[Python-Dev] SF #1462485 - StopIteration raised in body of 'with' statement suppressed

2006-04-02 Thread Delaney, Timothy (Tim)
Discovered this while playing around with the 2.5 released end of last week. Given: @contextmanager def gen(): print '__enter__' yield print '__exit__' with gen(): raise StopIteration('body') I would expect to get the StopIteration exception raised. Instead it's suppressed by th