diff --git a/tensorflow/python/util/object_identity.py b/tensorflow/python/util/object_identity.py index b4f4c63bc96..dfdd08d1501 100644 --- a/tensorflow/python/util/object_identity.py +++ b/tensorflow/python/util/object_identity.py @@ -30,7 +30,7 @@ class _ObjectIdentityWrapper(object): _ListWrapper objects to object-identity collections. """ - __slots__ = ["_wrapped", "__weakref__"] + __slots__ = ["_wrapped"] def __init__(self, wrapped): self._wrapped = wrapped @@ -72,8 +72,6 @@ class _ObjectIdentityWrapper(object): class _WeakObjectIdentityWrapper(_ObjectIdentityWrapper): - __slots__ = () - def __init__(self, wrapped): super(_WeakObjectIdentityWrapper, self).__init__(weakref.ref(wrapped)) @@ -101,8 +99,6 @@ class Reference(_ObjectIdentityWrapper): ``` """ - __slots__ = () - # Disabling super class' unwrapped field. unwrapped = property() @@ -157,8 +153,6 @@ class ObjectIdentityDictionary(collections_abc.MutableMapping): class ObjectIdentityWeakKeyDictionary(ObjectIdentityDictionary): """Like weakref.WeakKeyDictionary, but compares objects with "is".""" - __slots__ = ["__weakref__"] - def _wrap_key(self, key): return _WeakObjectIdentityWrapper(key) @@ -179,7 +173,7 @@ class ObjectIdentityWeakKeyDictionary(ObjectIdentityDictionary): class ObjectIdentitySet(collections_abc.MutableSet): """Like the built-in set, but compares objects with "is".""" - __slots__ = ["_storage", "__weakref__"] + __slots__ = ["_storage"] def __init__(self, *args): self._storage = set(self._wrap_key(obj) for obj in list(*args)) @@ -227,8 +221,6 @@ class ObjectIdentitySet(collections_abc.MutableSet): class ObjectIdentityWeakSet(ObjectIdentitySet): """Like weakref.WeakSet, but compares objects with "is".""" - __slots__ = () - def _wrap_key(self, key): return _WeakObjectIdentityWrapper(key)