Issue 4920: Fixed next() vs __next__() issues in the ABCs
for Iterator and MutableSet. Also added thorough test for
required abstractmethods.
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 38b44a5..36aca95 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -60,7 +60,7 @@
class Iterator(Iterable):
@abstractmethod
- def __next__(self):
+ def next(self):
raise StopIteration
def __iter__(self):
@@ -267,7 +267,7 @@
"""Return the popped value. Raise KeyError if empty."""
it = iter(self)
try:
- value = it.__next__()
+ value = next(it)
except StopIteration:
raise KeyError
self.discard(value)