Skip to content

Conversation

ericvsmith
Copy link
Member

@ericvsmith ericvsmith commented Mar 18, 2018

Also: if any dataclass in the hierarchy is frozen, the new class must also be frozen. And if the new class is frozen, all base dataclasses must be frozen.

https://bugs.python.org/issue32953

@ericvsmith ericvsmith merged commit f199bc6 into python:master Mar 19, 2018
@miss-islington
Copy link
Contributor

Thanks @ericvsmith for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

@ericvsmith: Please replace # with GH- in the commit message next time. Thanks!

@ericvsmith ericvsmith deleted the bpo-32953-dataclasses-inherit-frozen branch March 19, 2018 00:40
@bedevere-bot
Copy link

GH-6148 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 19, 2018
…ass derived classes (pythonGH-6147)

If a non-dataclass derives from a frozen dataclass, allow attributes to be set.
Require either all of the dataclasses in a class hierarchy to be frozen, or all non-frozen.
Store `@dataclass` parameters on the class object under `__dataclass_params__`. This is needed to detect frozen base classes.
(cherry picked from commit f199bc6)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
ericvsmith added a commit that referenced this pull request Mar 19, 2018
…ass derived classes (GH-6147) (GH-6148)

If a non-dataclass derives from a frozen dataclass, allow attributes to be set.
Require either all of the dataclasses in a class hierarchy to be frozen, or all non-frozen.
Store `@dataclass` parameters on the class object under `__dataclass_params__`. This is needed to detect frozen base classes.
(cherry picked from commit f199bc6)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
jo2y pushed a commit to jo2y/cpython that referenced this pull request Mar 23, 2018
…ass derived classes (python#6147)

If a non-dataclass derives from a frozen dataclass, allow attributes to be set.
Require either all of the dataclasses in a class hierarchy to be frozen, or all non-frozen.
Store `@dataclass` parameters on the class object under `__dataclass_params__`. This is needed to detect frozen base classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants