[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread Stepan Wagner
Stepan Wagner added the comment: Thank you, I wasn't paying attention enough. It works as you describe. On Tue, Dec 4, 2012 at 9:46 PM, R. David Murray wrote: > > R. David Murray added the comment: > > The only way I was able to replicate that result was by removing the > entire try/except bloc

[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread R. David Murray
R. David Murray added the comment: The only way I was able to replicate that result was by removing the entire try/except block, including the yield. In that case, wrap is no longer a generator, so the exception is raised before you enter the for loop. --

[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread Stepan Wagner
Stepan Wagner added the comment: OK, thanks for explanation. The behaviour is still strange, because when I delete try...except clause from wrap, the StopIteration exc from emptygen terminates the program with traceback. On Tue, Dec 4, 2012 at 9:14 PM, R. David Murray wrote: > > R. David Murra

[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread R. David Murray
R. David Murray added the comment: I don't see the bug here. Your for loop calls wrap. Wrap calls emptygen. Emptygen raises a StopIteration exception. That exception is of course propagated upward (it isn't caught by wrap), and the loop stops. -- nosy: +r.david.murray resolution:

[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread Stepan Wagner
New submission from Stepan Wagner: def emptygen(): # Or other more meaningful generator raise StopIteration yield def wrap(gen): next(gen) print("This should be printed or StopIteration raised.") while True: try: yield next(gen) except StopIter