[pypy-commit] pypy py3k: next has become __next__ in py3k

dusty noreply at buildbot.pypy.org
Tue Mar 13 21:31:37 CET 2012


Author: Dusty Phillips <dusty at buchuki.com>
Branch: py3k
Changeset: r53480:cc0d59814aec
Date: 2012-03-13 11:56 -0700
http://bitbucket.org/pypy/pypy/changeset/cc0d59814aec/

Log:	next has become __next__ in py3k

diff --git a/pypy/module/_continuation/app_continuation.py b/pypy/module/_continuation/app_continuation.py
--- a/pypy/module/_continuation/app_continuation.py
+++ b/pypy/module/_continuation/app_continuation.py
@@ -23,7 +23,7 @@
     def __iter__(self):
         return self
 
-    def next(self, value=None):
+    def __next__(self, value=None):
         res = self.switch(value)
         if self.is_pending():
             return res
diff --git a/pypy/module/_continuation/test/test_generator.py b/pypy/module/_continuation/test/test_generator.py
--- a/pypy/module/_continuation/test/test_generator.py
+++ b/pypy/module/_continuation/test/test_generator.py
@@ -16,13 +16,13 @@
             gen.switch(m*2)
         #
         g = f(10)
-        res = g.next()
+        res = g.__next__()
         assert res == 11
-        res = g.next()
+        res = g.__next__()
         assert res == 24
-        res = g.next()
+        res = g.__next__()
         assert res == 13
-        raises(StopIteration, g.next)
+        raises(StopIteration, g.__next__)
 
     def test_iterator(self):
         from _continuation import generator
@@ -65,6 +65,6 @@
             return "foo"
         #
         g = f(10)
-        res = g.next()
+        res = g.__next__()
         assert res == 11
-        raises(TypeError, g.next)
+        raises(TypeError, g.__next__)


More information about the pypy-commit mailing list