You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypyc can compile a parameterized dataclass, but it fails at import.
To Reproduce
Make a file with
from __future__ importannotationsfromdataclassesimportdataclassfromtypingimportTypeVar, GenericT=TypeVar("T")
classFoo(Generic[T]):
pass@dataclassclassBar(Foo[T]):
x: T@propertydefalso_x(self) ->T:
returnself.x
Compile with mypyc (it appears that it works)
Try importing Bar from file (to discover it does not work)
Actual Behavior
AttributeError Traceback (most recent call last)
...
----> 1 from test import Bar
File ~/.../test.py:15, in <module>
10 class Foo(Generic[T]):
11 pass
14 @dataclass
---> 15 class Bar(Foo[T]):
17 x: T
19 @property
20 def also_x(self) -> T:
AttributeError: attribute '__dict__' of 'type' objects is not writable
Your Environment
Mypy version used: '0.950'
Mypy command-line flags: --strict
Mypy configuration options from mypy.ini (and other config files): N/A
Python version used: 3.9.12
Operating system and version: macOS Monterey 12.4
The text was updated successfully, but these errors were encountered:
Bug Report
mypyc can compile a parameterized dataclass, but it fails at import.
To Reproduce
Actual Behavior
Your Environment
--strict
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: