[pypy-svn] r73385 - pypy/branch/cpython-extension/pypy/module/cpyext
xoraxax at codespeak.net
xoraxax at codespeak.net
Sun Apr 4 20:52:59 CEST 2010
Author: xoraxax
Date: Sun Apr 4 20:52:57 2010
New Revision: 73385
Added:
pypy/branch/cpython-extension/pypy/module/cpyext/iterator.py (contents, props changed)
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py
Log:
Add PyCallIter_New.
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py Sun Apr 4 20:52:57 2010
@@ -48,6 +48,7 @@
import pypy.module.cpyext.eval
import pypy.module.cpyext.getargs
import pypy.module.cpyext.import_
+import pypy.module.cpyext.iterator
# now that all rffi_platform.Struct types are registered, configure them
api.configure_types()
Added: pypy/branch/cpython-extension/pypy/module/cpyext/iterator.py
==============================================================================
--- (empty file)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/iterator.py Sun Apr 4 20:52:57 2010
@@ -0,0 +1,14 @@
+from pypy.module.cpyext.api import generic_cpy_call, cpython_api, PyObject
+from pypy.interpreter.error import OperationError
+import pypy.module.__builtin__.operation as operation
+
+
+ at cpython_api([PyObject, PyObject], PyObject)
+def PyCallIter_New(space, w_callable, w_sentinel):
+ """Return a new iterator. The first parameter, callable, can be any Python
+ callable object that can be called with no parameters; each call to it should
+ return the next item in the iteration. When callable returns a value equal to
+ sentinel, the iteration will be terminated.
+ """
+ return operation.iter_sentinel(space, w_callable, w_sentinel)
+
More information about the Pypy-commit
mailing list