commit | f8de3fea1280d55377d40c6e04b64114f9da2fa6 | [log] [tgz] |
---|---|---|
author | Georg Brandl <georg@python.org> | Fri Dec 03 07:55:44 2010 +0000 |
committer | Georg Brandl <georg@python.org> | Fri Dec 03 07:55:44 2010 +0000 |
tree | bf723ad86ffcf6bdc2550fe6304fd384d9445e08 | |
parent | 3b9406b08aad04c1f92d7a2ab03c8a42c3afb8be [diff] [blame] |
#10360: catch TypeError in WeakSet.__contains__, just like WeakKeyDictionary does.
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 @@ 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),),