Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
PY_3_10_PLUS,
PY_3_11_PLUS,
PY_3_13_PLUS,
PY_3_14_PLUS,
_AnnotationExtractor,
_get_annotations,
get_generic_base,
Expand Down Expand Up @@ -629,17 +628,6 @@ def evolve(*args, **changes):
return cls(**changes)


# Hack to the get the underlying dict out of a mappingproxy
# Use it with: cls.__dict__ | _deproxier
# See: https://github.com/python/cpython/pull/136893
class _Deproxier:
def __ror__(self, other):
return other


_deproxier = _Deproxier()


class _ClassBuilder:
"""
Iteratively build *one* class.
Expand Down Expand Up @@ -869,19 +857,9 @@ def _create_slots_class(self):
if k not in (*tuple(self._attr_names), "__dict__", "__weakref__")
}

if PY_3_14_PLUS:
# Clean up old dict to avoid leaks.
old_cls_dict = self._cls.__dict__ | _deproxier
old_cls_dict.pop("__dict__", None)
if "__weakref__" in self._cls.__dict__:
del self._cls.__weakref__

# Manually bump internal version tag.
try:
self._cls.__abstractmethods__ = self._cls.__abstractmethods__
except AttributeError:
self._cls.__abstractmethods__ = frozenset({"__init__"})
del self._cls.__abstractmethods__
# 3.14.0rc2+
if hasattr(sys, "_clear_type_descriptors"):
sys._clear_type_descriptors(self._cls)

# If our class doesn't have its own implementation of __setattr__
# (either from the user or by us), check the bases, if one of them has
Expand Down