[pypy-svn] r73594 - pypy/branch/cpython-extension/pypy/module/cpyext

trundle at codespeak.net trundle at codespeak.net
Fri Apr 9 19:30:24 CEST 2010


Author: trundle
Date: Fri Apr  9 19:30:22 2010
New Revision: 73594

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
   pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py
Log:
Implement wrap_lenfunc.


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py	Fri Apr  9 19:30:22 2010
@@ -730,6 +730,8 @@
                     state.check_and_raise_exception()
 
                 return ret
+            else:
+                return space.wrap(result)
         finally:
             if decref_args:
                 for ref in to_decref:

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/slotdefs.py	Fri Apr  9 19:30:22 2010
@@ -4,7 +4,7 @@
 from pypy.module.cpyext.api import generic_cpy_call, cpython_api, \
         PyObject
 from pypy.module.cpyext.typeobjectdefs import unaryfunc, wrapperfunc,\
-        ternaryfunc, PyTypeObjectPtr, binaryfunc, getattrfunc
+        ternaryfunc, PyTypeObjectPtr, binaryfunc, getattrfunc, lenfunc
 from pypy.module.cpyext.pyobject import from_ref
 from pypy.module.cpyext.state import State
 from pypy.interpreter.error import OperationError, operationerrfmt
@@ -49,6 +49,11 @@
     func_target = rffi.cast(ternaryfunc, func)
     return generic_cpy_call(space, func_target, w_self, w_args, w_kwds)
 
+def wrap_lenfunc(space, w_self, w_args, func):
+    func_len = rffi.cast(lenfunc, func)
+    check_num_args(space, w_args, 0)
+    return generic_cpy_call(space, func_len, w_self)
+
 @cpython_api([PyTypeObjectPtr, PyObject, PyObject], PyObject, external=True)
 def slot_tp_new(space, type, w_args, w_kwds):
     from pypy.module.cpyext.tupleobject import PyTuple_Check



More information about the Pypy-commit mailing list