[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

Eric V. Smith report at bugs.python.org
Mon Mar 19 07:32:31 EDT 2018


Eric V. Smith <eric at trueblade.com> added the comment:

My point is that the problem is that after:

@dataclass
class Base:
    __slots__ = ('x',)
    x: Any

Base.x has a value (it's the member_descriptor for x). That's what's causing the problem that when adding a field to the derived class, it thinks you're adding a field without a default value after one that has a default value.

I agree that I could detect this specific case and allow it. My comment about the error message was inaccurate.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33100>
_______________________________________


More information about the Python-bugs-list mailing list