summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-10-04 16:53:28 (GMT)
committerGitHub <noreply@github.com>2022-10-04 16:53:28 (GMT)
commit4f380db1a539bf7ae157d1e0791b5ac3fecfcf01 (patch)
treed4487b0655da08981e897e9fe1e4d904c5eb0c58 /Lib/dataclasses.py
parent53503ff60e9a4727af0d9a1096418675e72a0fae (diff)
downloadcpython-4f380db1a539bf7ae157d1e0791b5ac3fecfcf01.zip
cpython-4f380db1a539bf7ae157d1e0791b5ac3fecfcf01.tar.gz
cpython-4f380db1a539bf7ae157d1e0791b5ac3fecfcf01.tar.bz2
gh-96142: add missing params to `dataclass._DataclassParams` (gh-96382)
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index efd8346..65fb8f2 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -320,15 +320,25 @@ class _DataclassParams:
'order',
'unsafe_hash',
'frozen',
+ 'match_args',
+ 'kw_only',
+ 'slots',
+ 'weakref_slot',
)
- def __init__(self, init, repr, eq, order, unsafe_hash, frozen):
+ def __init__(self,
+ init, repr, eq, order, unsafe_hash, frozen,
+ match_args, kw_only, slots, weakref_slot):
self.init = init
self.repr = repr
self.eq = eq
self.order = order
self.unsafe_hash = unsafe_hash
self.frozen = frozen
+ self.match_args = match_args
+ self.kw_only = kw_only
+ self.slots = slots
+ self.weakref_slot = weakref_slot
def __repr__(self):
return ('_DataclassParams('
@@ -337,7 +347,11 @@ class _DataclassParams:
f'eq={self.eq!r},'
f'order={self.order!r},'
f'unsafe_hash={self.unsafe_hash!r},'
- f'frozen={self.frozen!r}'
+ f'frozen={self.frozen!r},'
+ f'match_args={self.match_args!r},'
+ f'kw_only={self.kw_only!r},'
+ f'slots={self.slots!r},'
+ f'weakref_slot={self.weakref_slot!r}'
')')
@@ -905,7 +919,9 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
globals = {}
setattr(cls, _PARAMS, _DataclassParams(init, repr, eq, order,
- unsafe_hash, frozen))
+ unsafe_hash, frozen,
+ match_args, kw_only,
+ slots, weakref_slot))
# Find our base classes in reverse MRO order, and exclude
# ourselves. In reversed order so that more derived classes