summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-01 18:50:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-01 18:50:56 (GMT)
commit66c4a6b51cea40215e8f61e1abe2e3d89c4aeb1e (patch)
tree9514206018d91419cad25cdfdc9f8f4084270935 /Lib/_abcoll.py
parent449b7d95d46f0b2e8a1fd73642d391ac3a29518e (diff)
downloadcpython-66c4a6b51cea40215e8f61e1abe2e3d89c4aeb1e.zip
cpython-66c4a6b51cea40215e8f61e1abe2e3d89c4aeb1e.tar.gz
cpython-66c4a6b51cea40215e8f61e1abe2e3d89c4aeb1e.tar.bz2
Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 40cc23e..990ff00 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -286,10 +286,9 @@ class MutableSet(Set):
self.add(value)
return self
- def __iand__(self, c):
- for value in self:
- if value not in c:
- self.discard(value)
+ def __iand__(self, it):
+ for value in (self - it):
+ self.discard(value)
return self
def __ixor__(self, it):