You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the pure Python implementation, if a MultiDict is constructed with a generator argument:
headers = CIMultiDict(
(
k.decode('utf-8', 'surrogateescape'),
v.decode('utf-8', 'surrogateescape'),
)
for k, v in event.headers
)
then the resulting MultiDict will be empty, instead of containing the key/value pairs as expected. This is because the generator is iterated over twice, and the first iteration discards all of the pairs.
The text was updated successfully, but these errors were encountered:
jchampio
added a commit
to jchampio/multidict
that referenced
this issue
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
fixesaio-libs#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#2.
When using the pure Python implementation, if a
MultiDict
is constructed with a generator argument:then the resulting
MultiDict
will be empty, instead of containing the key/value pairs as expected. This is because the generator is iterated over twice, and the first iteration discards all of the pairs.The text was updated successfully, but these errors were encountered: