[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)
Alexander Hirner
report at bugs.python.org
Wed Jan 1 12:10:09 EST 2020
Alexander Hirner <a.hirner at gmail.com> added the comment:
Dropping ABCMeta stops at instantiation. This should be in the dataclass code that's been generated.
File "<string>", line 2, in __init__
AttributeError: can't set attribute
Repro:
```
class QuasiABC:
@property
@abstractmethod
def x(self) -> int: ...
@dataclass(frozen=True)
class E(QuasiABC):
x: int
E(10)
```
Interestingly, frozen=False is giving the same error.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39134>
_______________________________________
More information about the Python-bugs-list
mailing list