On Tue, Jan 26, 2010 at 03:10:33PM -0600, Shawn Walker wrote: > On 01/26/10 03:05 PM, johan...@sun.com wrote: > >On Tue, Jan 26, 2010 at 02:56:17PM -0600, Shawn Walker wrote: > >>On 01/26/10 02:49 PM, johan...@sun.com wrote: > >>>On Tue, Jan 26, 2010 at 11:33:40AM -0600, Shawn Walker wrote: > >>>>On 01/25/10 07:38 PM, johan...@sun.com wrote: > >>>>>Okay. Here's a webrev that should implement what we discussed earlier > >>>>>this afternoon. Due to the variety of different exception cases > >>>>>possible and the different clean-ups needed, the wrapper function is a > >>>>>bit more complicated than a simple try/finally, but it seems to work. > >>>>> > >>>>> http://cr.opensolaris.org/~johansen/webrev-3720-4/ > >>>> > >>>>I don't believe that the GeneratorExit should be re-raised to the > >>>>caller. My understanding was that the GeneratorExit was > >>>>intentionally thrown at the generator itself so that it could do > >>>>whatever was needed to abort and handle it without further > >>>>assistance. > >>>> > >>>>Was there a specific reasoning behind doing so instead of just > >>>>issuing a "return" or "pass"? > >>> > >>>According to the documentation, this would be the correct way to handle > >>>the exception. I've verified that calling close() on the generator and > >>>re-raising GeneratorExit doesn't leak the exception out to other levels. > >>> > >>>http://docs.python.org/reference/expressions.html > >>> > >>> generator.close() > >>> Raises a GeneratorExit at the point where the generator > >>> function was paused. If the generator function then raises > >>> StopIteration (by exiting normally, or due to already being > >>> closed) or GeneratorExit (by not catching the exception), > >>> close returns to its caller. If the generator yields a > >>> value, a RuntimeError is raised. If the generator raises any > >>> other exception, it is propagated to the caller. close() > >>> does nothing if the generator has already exited due to an > >>> exception or normal exit. > >> > >>Ah, sorry I missed that bit. However, it does imply that if > >>GeneratorExit is re-raised, that implies that it wasn't caught. > >>Since we actually caught the exception, wouldn't it make sense to > >>simply return? > > > >I will give that a try. This documentation is a unclear. I drew the > >opposite conclusion from you: re-raising GeneratorExit is necessary for > >.close() to return to its caller. > > It says that if the generator function raises StopIteration (by > exiting normally) it should return to the caller. It doesn't really > matter, so feel free to do whichever way you think we should going > forward.
I have changed the code to return from GeneratorExit and all still works properly. If you have a minute to look at the diff for 14173, I'd like to include that fix in this wad. The change is very small and straight-forward. Thanks, -j _______________________________________________ pkg-discuss mailing list pkg-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/pkg-discuss