[Web-SIG] [Paste] GeneratorExit

Phillip J. Eby pje at telecommunity.com
Wed Nov 14 14:46:22 CET 2007

At 12:05 PM 11/10/2007 -0600, Ian Bicking wrote:
>Jochen Kupperschmidt wrote:
> > Hi Ian,
> >
> > when using your Paste suite and its HTTP server, I sporadically come
> > across a traceback related to a GeneratorExit. It does not seem to break
> > stuff, but it confuses me and fills up my log.
> >
> > I put the traceback, together with some description and related links
> > that might help examining and fixing it, at
> > http://paste.pocoo.org/show/9976/
> > It should be easy to fix, as far as I can tell. Please let me know what
> > you think.
>I'm guessing this is some interaction between the extensions to the
>generator protocol in Python 2.5, and its overlap with app_iter.close()
>in WSGI.  I'm not sure what the proper behavior here is.  Just swallow
>the error?  Maybe PJE has an idea of what should happen here.

What should happen here is that the person who wrote the generator 
such that it catches and ignores GeneratorExit needs to fix it.  The 
error shown in that traceback is:

"RuntimeError: generator ignored GeneratorExit"

Which means it's the generator that's broken.  It's presumably got a 
try/except block that either doesn't re-raise the error, or that 
contains a yield.

More information about the Web-SIG mailing list