CgitbMiddleware doesn't handle close() properly

2 views
Skip to first unread message

Xavid

unread,
Jan 25, 2012, 9:54:44 AM1/25/12
to Paste Users
The CgitbMiddleware tries to yield an error page even after catching a
GeneratorExit (which happens when the iterator is .close()d).
yielding after close is invalid behavior for an iterator and results
in a "RuntimeError: generator ignored GeneratorExit" exception.

It seems like the right fix would be to add something like

except GeneratorExit:
if not error_on_close:
app_iter.close()

before the "except:" line in the definition of catching_iter().

(I tried to open a ticket in Trac, but even after creating an account
it wouldn't let me create a new ticket. Let me know if there's a
better way to report this.)

Cheers,
~Xavid
Reply all
Reply to author
Forward
0 new messages