diff options
author | Raymond Hettinger <python@rcn.com> | 2009-04-01 19:05:50 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-04-01 19:05:50 (GMT) |
commit | 3f10a952f6056b6797e4187bcfa1a97c21d1b3bb (patch) | |
tree | fd77e13d51d8e407ecc12a206b67cbb670ee88bc /Lib/_abcoll.py | |
parent | 0759dd66c581a65381412a2ff98dac8edd58ddee (diff) | |
download | cpython-3f10a952f6056b6797e4187bcfa1a97c21d1b3bb.zip cpython-3f10a952f6056b6797e4187bcfa1a97c21d1b3bb.tar.gz cpython-3f10a952f6056b6797e4187bcfa1a97c21d1b3bb.tar.bz2 |
Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r-- | Lib/_abcoll.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index 45747a6..7b01178 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -320,10 +320,9 @@ class MutableSet(Set): self.add(value) return self - def __iand__(self, c: Container): - for value in self: - if value not in c: - self.discard(value) + def __iand__(self, it: Iterable): + for value in (self - it): + self.discard(value) return self def __ixor__(self, it: Iterable): |