Bug Report
mypy complaining that class annotated with @dataclass(slots=True) has no attribute __slots__
To Reproduce
from dataclasses import dataclass
class Point1:
__slots__ = ('x', 'y')
@dataclass(slots=True)
class Point2:
x: float
y: float
print(Point1.__slots__)
print(Point2.__slots__)
Expected Behavior
No error should be produced
Actual Behavior
Running python test.py produces
Running mypy test.py produces
test.py:15: error: "type[Point2]" has no attribute "__slots__" [attr-defined]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used:
1.4.1
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini (and other config files):
- Python version used:
3.11.1