Skip to content

Wrong type for hdrs in urllib.error.HTTPError #10092

Open
@bdrung

Description

@bdrung

Example code code.py:

import urllib.error
raise urllib.error.HTTPError("https://example.com/", 502, "Bad Gateway", hdrs={}, fp=None)

mypy complains:

code.py:2: error: Argument "hdrs" to "HTTPError" has incompatible type "Dict[<nothing>, <nothing>]"; expected "Message"  [arg-type]

Looking at the Python stdlib code, hdrs is always a dict[str, str].

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions