Skip to content

CIMultiDict has incompatible type Dict[istr, str] #644

Closed
@rugleb

Description

@rugleb

Long story short

The mypy checks fail if the dictionary keys passed to the constructor are of the istr type.

Expected behaviour

The mypy checks have passed.

Actual behaviour

Error from mypy:

headers.py:5: error: Argument 1 to "CIMultiDict" has incompatible type "Dict[istr, str]"; expected "Union[Mapping[Union[str, istr], Any], Dict[Union[str, istr], Any], MultiMapping[Any], Iterable[Tuple[Union[str, istr], Any]]]"

Steps to reproduce

Run mypy on this script:

from aiohttp import hdrs
from multidict import CIMultiDict, CIMultiDictProxy

headers = CIMultiDictProxy(
    CIMultiDict({
        hdrs.CONTENT_LENGTH: "40",
        hdrs.CONTENT_TYPE: "text/xml",
    })
)

Your environment

Python v3.9.4
aiohttp v3.7.4.post0
multidict v5.1.0
mypy v0.910

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