This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hbq1
Recipients hbq1
Date 2021-02-09.07:12:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612854759.36.0.400211114548.issue43176@roundup.psfhosted.org>
In-reply-to
Content
Dataclasses derived from empty frozen bases skip immutability checks.

Repro snippet:

```
import dataclasses

@dataclasses.dataclass(frozen=True)
class Base:
  pass

@dataclasses.dataclass
class Derived(Base):
  a: int

d = Derived(2)
# OK
```

Usecase: sometimes developers define an empty frozen base dataclass with detailed docs and require other dataclasses to inherit from it as a code contract to avoid accidental in-place modifications. 
This bug makes this strategy ineffective.

Affects all versions of Python that support dataclasses (including the backport for py3.6).
History
Date User Action Args
2021-02-09 07:12:39hbq1setrecipients: + hbq1
2021-02-09 07:12:39hbq1setmessageid: <1612854759.36.0.400211114548.issue43176@roundup.psfhosted.org>
2021-02-09 07:12:39hbq1linkissue43176 messages
2021-02-09 07:12:39hbq1create