mypy started crashing on the code below starting with version 1.16.0 — it was still working fine in 1.15.0.
# mypy mypy-internal-error.py --show-traceback
mypy-internal-error.py:27: error: Name "value" already defined on line 22 [no-redef]
mypy-internal-error.py:27: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.17.0
Traceback (most recent call last):
File "mypy/checker.py", line 584, in accept
File "mypy/nodes.py", line 610, in accept
File "mypy/checker.py", line 657, in visit_overloaded_func_def
File "mypy/checker.py", line 739, in _visit_overloaded_func_def
File "mypy/checker.py", line 2081, in check_method_override
File "mypy/checker.py", line 2119, in check_method_or_accessor_override_for_base
File "mypy/checker.py", line 2172, in check_method_override_for_base_with_name
AssertionError:
mypy-internal-error.py:27: : note: use --pdb to drop into pdb
from dataclasses import InitVar, dataclass, field
from typing import Callable
@dataclass
class ClassA:
_value: int
@property
def value(self) -> int:
return self._value
@value.setter
def value(self, value: int):
self._value = value
@dataclass
class ClassB(ClassA):
getter: Callable[[], int]
setter: Callable[[int], None]
value: InitVar[int]
def __post_init__(self, value: int):
self.value = value
@property
def value(self) -> int:
return self.getter()
@value.setter
def value(self, value: int):
self.setter(value)
Crash Report
mypy started crashing on the code below starting with version 1.16.0 — it was still working fine in 1.15.0.
Traceback
To Reproduce
Your Environment
mypy.ini(and other config files): none