Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close iterable after iteration #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

secretmike
Copy link

If the response iterator has a .close() method call it after iteration
is complete.

This is required by the WSGI specification, details can be found here:
https://www.python.org/dev/peps/pep-0333/#specification-details

Same idea as #6 but I moved the .close() call inside the outer try/except. This means the iterable will be closed() before the transaction is aborted on error. I'm not 100% sure this maintains the requirements for aborting, but this works well to solve my problem using WSGI middlewares that rely on close() being called.

If the response iterator has a `.close()` method call it after iteration
is complete.

This is required by the WSGI specification, details can be found here:
https://www.python.org/dev/peps/pep-0333/#specification-details
Seems to be required for later versions of pip:
travis-ci/travis-ci#6727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant