Skip to content

Python MultiDict constructor discards generator content #2

Closed

Description

@jchampio

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.

Activity

  1. added a commit that references this issue on Jun 4, 2016
    e12f9ac
  2. added a commit that references this issue on Jun 4, 2016
    63c60a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions