]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-32953: Dataclasses: frozen should not be inherited for non-dataclass derived...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 Mar 2018 01:03:36 +0000 (18:03 -0700)
committerEric V. Smith <ericvsmith@users.noreply.github.com>
Mon, 19 Mar 2018 01:03:36 +0000 (21:03 -0400)
commit45648312e540cda3b10109b6a808cbf6955c84eb
tree0460e82017ba805d7813b68ed01ba20e555e499c
parent3c0a5a7c7ba8fbbc95dd1fe76cd7a1c0ce167371
bpo-32953: Dataclasses: frozen should not be inherited for non-dataclass 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 f199bc655eb50c28e94010714629b376bbbd077b)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Lib/dataclasses.py
Lib/test/test_dataclasses.py
Misc/NEWS.d/next/Library/2018-03-18-17-38-48.bpo-32953.t8WAWN.rst [new file with mode: 0644]