summaryrefslogtreecommitdiffstats
path: root/Lib/_weakrefset.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_weakrefset.py')
-rw-r--r--Lib/_weakrefset.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py
index 3de3bda..4265369 100644
--- a/Lib/_weakrefset.py
+++ b/Lib/_weakrefset.py
@@ -66,7 +66,11 @@ class WeakSet:
return sum(x() is not None for x in self.data)
def __contains__(self, item):
- return ref(item) in self.data
+ try:
+ wr = ref(item)
+ except TypeError:
+ return False
+ return wr in self.data
def __reduce__(self):
return (self.__class__, (list(self),),