pumazi/wsgi_intercept2 — Issue #8: 8 - WSGI PEP is violated - iterators' close() method isn't called 
Author: pumazi
Created: 2011-12-22 19:25:17+00:00
State: open

What steps will reproduce the problem?
1. Apply wsgi_compliance_test.diff. It adds a test that's just a copy of
the httplib2 test with paste.lint added.
2. Do "nosetests test.test_wsgi_compliance"

What is the expected output? What do you see instead?

The test passes from nose's perspective, but emits the following on stderr:

Iterator garbage collected without being closedException
exceptions.AssertionError: AssertionError('Iterator garbage collected
without being closed',) in <bound method IteratorWrapper.__del__ of
<paste.lint.IteratorWrapper object at 0x1342110>> ignored

The test doesn't actually fail because lint detects the error too late - it
only knows something's gone wrong when __del__ is called.

What version of the product are you using? On what operating system?

svn rev 34

Please provide any additional information below.

In the "Specification Details" section, the WSGI PEP says:

"""
If the iterable returned by the application has a close() method, the
server or gateway must call that method upon completion of the current
request, whether the request was completed normally, or terminated early
due to an error.
"""

The attached wsgi_iterator_compliance_fix.diff modifies
wsgi_fake_socket.makefile to do as the spec asks, and lint stops
complaining. It does still emit a warning about QUERY_STRING being absent,
though.

Original link: http://code.google.com/p/wsgi-intercept/issues/detail?id=8