Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3k
Open
Description
Bug Report
The following code type-checked withmypy 1.16.1
in--strict
mode but does not type-check withmypy 1.17
and the master branch (currentlyeb07c06) in--strict
mode. Bisecting points to the commit33d1eed.
Note that the problem does not occur if--strict
mode is disabled.
To Reproduce
importinspectimporttypingfromtypingimportAny,ClassVardefis_classvar(cls:type,scope:dict[Any,type])->bool:ann=inspect.get_annotations(cls,eval_str=True,locals=scope).get("kind")ifannisNone:raiseException("Should be annotated.")returntyping.get_origin(ann)isnotClassVar
Actual Behavior
mypy --strict test_any.pytest_any.py:9: error: Non-overlapping identity check (left operand type: "ParamSpec", right operand type: "<typing special form>") [comparison-overlap]Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used:
mypy 1.17
andmaster
(bad),mypy 1.16.1
(good) - Mypy command-line flags:
--strict
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used:
3.13
Note thatreveal_type(ann)
givesAny | None
and that annotatingann: Any | None
solves the problem.