summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-04-06 13:46:30 (GMT)
committerGitHub <noreply@github.com>2021-04-06 13:46:30 (GMT)
commit8a34a0793bcb830350dac675524310bb285e5e4f (patch)
tree2fcd7aac1392b87fecbd0ffedc0e94a99df4b4f1 /Lib/dataclasses.py
parentc7ccb0ff61e443633d0c54cb18b5633a8e95b30c (diff)
downloadcpython-8a34a0793bcb830350dac675524310bb285e5e4f.zip
cpython-8a34a0793bcb830350dac675524310bb285e5e4f.tar.gz
cpython-8a34a0793bcb830350dac675524310bb285e5e4f.tar.bz2
bpo-43176: Fix processing of empty dataclasses (GH-24484) (GH-25205)
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 (cherry picked from commit 376ffc6ac491da74920aed1b8e35bc371cb766ac) Co-authored-by: Iurii Kemaev <6885137+hbq1@users.noreply.github.com> Co-authored-by: Iurii Kemaev <6885137+hbq1@users.noreply.github.com>
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 21c7e0c..e015254 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -836,7 +836,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