[pypy-svn] r14924 - in pypy/dist/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Jul 22 18:11:38 CEST 2005
Author: arigo
Date: Fri Jul 22 18:11:36 2005
New Revision: 14924
Modified:
pypy/dist/pypy/rpython/robject.py
pypy/dist/pypy/rpython/test/test_robject.py
Log:
Iteration over PyObject*.
Modified: pypy/dist/pypy/rpython/robject.py
==============================================================================
--- pypy/dist/pypy/rpython/robject.py (original)
+++ pypy/dist/pypy/rpython/robject.py Fri Jul 22 18:11:36 2005
@@ -26,6 +26,8 @@
class PyObjRepr(Repr):
def convert_const(self, value):
return pyobjectptr(value)
+ def make_iterator_repr(self):
+ return pyobj_repr
pyobj_repr = PyObjRepr()
pyobj_repr.lowleveltype = Ptr(PyObject)
Modified: pypy/dist/pypy/rpython/test/test_robject.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_robject.py (original)
+++ pypy/dist/pypy/rpython/test/test_robject.py Fri Jul 22 18:11:36 2005
@@ -46,3 +46,15 @@
assert res._obj.value == 2
res = interpret(f, [0])
assert res._obj.value == '3'
+
+def test_listofobj_iter():
+ def f(look):
+ lst = ['*', 2, 5]
+ for u in lst:
+ if u == look:
+ return True
+ return False
+ res = interpret(f, [1])
+ assert res is False
+ res = interpret(f, [2])
+ assert res is True
More information about the Pypy-commit
mailing list