summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorIurii Kemaev <6885137+hbq1@users.noreply.github.com>2021-04-06 05:14:01 (GMT)
committerGitHub <noreply@github.com>2021-04-06 05:14:01 (GMT)
commit376ffc6ac491da74920aed1b8e35bc371cb766ac (patch)
tree9b0561f3aa54ba7a825ebabc107afe5a73aec32a /Lib/dataclasses.py
parent4663e5f39e9f872dcd69545f293e832d5855d084 (diff)
downloadcpython-376ffc6ac491da74920aed1b8e35bc371cb766ac.zip
cpython-376ffc6ac491da74920aed1b8e35bc371cb766ac.tar.gz
cpython-376ffc6ac491da74920aed1b8e35bc371cb766ac.tar.bz2
bpo-43176: Fix processing of empty dataclasses (GH-24484)
When a dataclass inherits from an empty base, all immutability checks are omitted. This PR fixes this and adds tests for it. Automerge-Triggered-By: GH:ericvsmith
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 3de2ec0..afc4b82 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -860,7 +860,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen):
# Only process classes that have been processed by our
# decorator. That is, they have a _FIELDS attribute.
base_fields = getattr(b, _FIELDS, None)
- if base_fields:
+ if base_fields is not None:
has_dataclass_bases = True
for f in base_fields.values():
fields[f.name] = f