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

Don't double-iterate during MultiDict initialization #3

Merged
merged 1 commit into from
Jun 4, 2016

Conversation

jchampio
Copy link
Contributor

@jchampio jchampio commented Jun 4, 2016

Previously, the MultiDict constructor iterated twice over its argument:
once as a sanity check on its contents, and once again to add those
contents to the dictionary. If a generator was passed as an argument,
the first iteration would drain it, and the resulting dictionary would
be empty.

To fix this, save the contents of the generator in another list. This
fixes #2.

Previously, the MultiDict constructor iterated twice over its argument:
once as a sanity check on its contents, and once again to add those
contents to the dictionary. If a generator was passed as an argument,
the first iteration would drain it, and the resulting dictionary would
be empty.

To fix this, save the contents of the generator in another list. This
fixes aio-libs#2.
@asvetlov asvetlov merged commit 63c60a6 into aio-libs:master Jun 4, 2016
@asvetlov
Copy link
Member

asvetlov commented Jun 4, 2016

thanks

@jchampio jchampio deleted the dev/generator branch June 4, 2016 19:28
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.

Python MultiDict constructor discards generator content
2 participants