Skip to content

Commit e0d61f7

Browse files
Apply suggestions from code review
Co-authored-by: Alyssa Coghlan <[email protected]>
1 parent 027f629 commit e0d61f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/dataclasses.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,10 @@ def _add_slots(cls, is_frozen, weakref_slot, defined_fields):
13391339
break
13401340

13411341
# gh-135228: Make sure the original class can be garbage collected.
1342+
# Bypass mapping proxy to allow __dict__ to be removed
13421343
old_cls_dict = cls.__dict__ | _deproxier
1343-
old_cls_dict.pop('__weakref__', None)
13441344
old_cls_dict.pop('__dict__', None)
1345+
del cls.__weakref__
13451346

13461347
return newcls
13471348

0 commit comments

Comments
 (0)