mirror of
https://github.com/python/cpython.git
synced 2025-12-03 08:04:34 +00:00
Revert "gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (#136893)" (#137014)
This reverts commit 46cbdf967a.
This commit is contained in:
parent
38b936cc99
commit
6a285f94c6
3 changed files with 0 additions and 54 deletions
|
|
@ -1338,13 +1338,6 @@ def _add_slots(cls, is_frozen, weakref_slot, defined_fields):
|
|||
or _update_func_cell_for__class__(member.fdel, cls, newcls)):
|
||||
break
|
||||
|
||||
# gh-135228: Make sure the original class can be garbage collected.
|
||||
# Bypass mapping proxy to allow __dict__ to be removed
|
||||
old_cls_dict = cls.__dict__ | _deproxier
|
||||
old_cls_dict.pop('__dict__', None)
|
||||
if "__weakref__" in cls.__dict__:
|
||||
del cls.__weakref__
|
||||
|
||||
return newcls
|
||||
|
||||
|
||||
|
|
@ -1739,11 +1732,3 @@ def _replace(self, /, **changes):
|
|||
# changes that aren't fields, this will correctly raise a
|
||||
# TypeError.
|
||||
return self.__class__(**changes)
|
||||
|
||||
|
||||
# Hack to the get the underlying dict out of a mappingproxy
|
||||
# Use it with: cls.__dict__ | _deproxier
|
||||
class _Deproxier:
|
||||
def __ror__(self, other):
|
||||
return other
|
||||
_deproxier = _Deproxier()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue