aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 7c3285cf440..82b08fc0178 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -1189,6 +1189,9 @@ def _add_slots(cls, is_frozen, weakref_slot):
# Remove __dict__ itself.
cls_dict.pop('__dict__', None)
+ # Clear existing `__weakref__` descriptor, it belongs to a previous type:
+ cls_dict.pop('__weakref__', None) # gh-102069
+
# And finally create the class.
qualname = getattr(cls, '__qualname__', None)
cls = type(cls)(cls.__name__, cls.__bases__, cls_dict)