Bug Report
From as far as I could boil it down, it seems that when you use the type keyword in one place referencing a type name that is undefined, and then using a another type keyword to re-assign the same global name on a class member, Mypy freezes.
To Reproduce
from typing import TypedDict
type Resource = dict[str, Any]
class CustomizeRequest: ...
class DecoratorController:
type CustomizeRequest = CustomizeRequest
https://mypy-play.net/?mypy=latest&python=3.12&gist=f69f8d424122ed4c7d0778b37e34021f
It begins working as soon as you do any one of these things:
from typing import Any (passes)
type SomeOtherName = CustomizeRequest (fails, Any undefined)
- remove
type Resource = dict[str, Any] (passes)
Expected Behavior
Mypy should not freeze, but error and report that Any is undefined.
Actual Behavior
As explained above.
Your Environment
- Mypy version used: 1.14.1 (compiled: yes)
- Mypy command-line flags: n/a
- Mypy configuration options from
mypy.ini (and other config files): strict = true
- Python version used: CPython 3.13.1
Bug Report
From as far as I could boil it down, it seems that when you use the
typekeyword in one place referencing a type name that is undefined, and then using a anothertypekeyword to re-assign the same global name on a class member, Mypy freezes.To Reproduce
It begins working as soon as you do any one of these things:
from typing import Any(passes)type SomeOtherName = CustomizeRequest(fails,Anyundefined)type Resource = dict[str, Any](passes)Expected Behavior
Mypy should not freeze, but error and report that
Anyis undefined.Actual Behavior
As explained above.
Your Environment
mypy.ini(and other config files):strict = true