Skip to content

stubtest: Problem with runtime type aliases #13114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
srittau opened this issue Jul 13, 2022 · 0 comments · Fixed by #13116
Closed

stubtest: Problem with runtime type aliases #13114

srittau opened this issue Jul 13, 2022 · 0 comments · Fixed by #13116
Labels
bug mypy got something wrong topic-stubtest topic-type-alias TypeAlias and other type alias issues

Comments

@srittau
Copy link
Contributor

srittau commented Jul 13, 2022

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]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-stubtest topic-type-alias TypeAlias and other type alias issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants