Skip to content

type not generic when running with Python < 3.9 #10303

@srittau

Description

@srittau

Bug Report

Please consider the following stub file:

x: dict[str, str]
y: type[str]

When checking it with mypy 0.820+dev.1e96f1df48a6e06ba598fa8230b96671b206cba0 and Python 3.9.4, it passes. Using Python 3.8.9 on the other hand, produces the following output:

foo.pyi:2: error: "type" expects no type arguments, but 1 given

It's weird that generic dict works, but generic type doesn't. (Although I'd expect both to work with any Python version.)

This came up during python/typeshed#5192.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions