Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r54859:3f67f5b4d3d4
Date: 2012-04-30 23:28 +0200
http://bitbucket.org/pypy/pypy/changeset/3f67f5b4d3d4/

Log:    To fake a py3k generator on top of pyhon2, it's necessary to rename
        .next() to .__next__(). This fixes space.wrap((x for x in
        range(10)))

diff --git a/pypy/objspace/std/fake.py b/pypy/objspace/std/fake.py
--- a/pypy/objspace/std/fake.py
+++ b/pypy/objspace/std/fake.py
@@ -77,6 +77,8 @@
             kw[meth_name] = EvenMoreObscureWrapping(__builtin__.eval("lambda 
m,*args,**kwds: m.%s(*args,**kwds)" % meth_name))
     else:
         for s, v in cpy_type.__dict__.items():
+            if s == 'next':
+                s = '__next__'
             if not (cpy_type is unicode and s in ['__add__', '__contains__']):
                 if s != '__getattribute__' or cpy_type is type(sys) or 
cpy_type is type(Exception):
                     kw[s] = v
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to