Skip to content

stubtest: Problem with runtime type aliases #13114

Closed
@srittau

Description

@srittau

Bug Report

Using mypy 0.960 and Python 3.9.2, stubtest reports a mismatch between runtime and a stub file when both use an identical TypeAlias annotation:

error: wsgiref.types.WSGIEnvironment is not a type
Stub: at line 1003
<TypeInfo builtins.dict>
Runtime:
dict[str, typing.Any]

(Source: https://github.com/python/typeshed/runs/7319247103?check_suite_focus=true)

In this case, the offending line is WSGIEnvironment: TypeAlias = dict[str, Any], both at runtime and the stub. Interestingly, the following line works ok:

WSGIApplication: TypeAlias = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions