summaryrefslogtreecommitdiff
path: root/Lib/_weakrefset.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_weakrefset.py')
-rw-r--r--Lib/_weakrefset.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py
index 42653699a3..f34aa864bc 100644
--- a/Lib/_weakrefset.py
+++ b/Lib/_weakrefset.py
@@ -63,7 +63,7 @@ class WeakSet:
yield item
def __len__(self):
- return sum(x() is not None for x in self.data)
+ return len(self.data) - len(self._pending_removals)
def __contains__(self, item):
try: