Bug Report
Starting with version 1.1, I get an error when calling Tuple[float, ...]'s __new__.
To Reproduce
from typing import Iterable, Tuple
class Foo(Tuple[float, ...]):
def __new__(cls, values: Iterable[float]) -> Foo:
return tuple.__new__(cls, map(float, values))
Expected Behavior
This should not be rejected by mypy (and it wasn't until version 1.1.1)
Actual Behavior
Starting with mypy 1.1.1, mypy complains with the following error
test.py:8: error: Value of type variable "Self" of "__new__" of "tuple" cannot be "Foo" [type-var]
Remark
Changing tuple.__new__ to super().__new__ makes mypy complain (both mypy version 1.1.1 and 1.0.1) with
Argument 1 to "map" has incompatible type "Type[float]"; expected "Callable[[float], _T_co]"
Your Environment
- Mypy version used: 1.1.1 and 1.0.1
- Mypy command-line flags: none
- Mypy configuration options from
pyproject.toml:
[tool.mypy]
[[tool.mypy.overrides]]
module = "pandas.*"
ignore_missing_imports = true
- Python version used: tested on 3.8 and 3.11