mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
This commit is contained in:
parent
0759dd66c5
commit
3f10a952f6
3 changed files with 30 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue