[issue5647] MutableSet.__iand__ implementation calls self.discard while iterating on self

2009-04-01 Thread Matteo Dell'Amico
New submission from Matteo Dell'Amico de...@linux.it: The current MutableSet.__iand__ implementation calls self.discard while iterating on self. This creates strange problems while implementing MutableSet with simple choices. For example, consider the attached file which implements set by

[issue5647] MutableSet.__iand__ implementation calls self.discard while iterating on self

2009-04-01 Thread Matteo Dell'Amico
Matteo Dell'Amico de...@linux.it added the comment: I suggest solving the problem by changing the implementation to: def __iand__(self, c): self -= self - c: or to def __iand__(self, c): for item in self - c: self.discard(item) --

[issue5647] MutableSet.__iand__ implementation calls self.discard while iterating on self

2009-04-01 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5647 ___ ___

[issue5647] MutableSet.__iand__ implementation calls self.discard while iterating on self

2009-04-01 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for the report. Fixed in r70969, r70970, r70973, and r70974. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org