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

xoraxax at codespeak.net xoraxax at codespeak.net
Wed Apr 14 11:04:09 CEST 2010


Author: xoraxax
Date: Wed Apr 14 11:04:08 2010
New Revision: 73731

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/TODO
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
Log:
Update TODO file, drop libffi usage in favor of direct fnptr calling, should hold the GIL now when calling.

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/TODO
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/TODO	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/TODO	Wed Apr 14 11:04:08 2010
@@ -20,9 +20,6 @@
  - refactor management of py_objects_r2w and py_objects_w2r, this can
    probably be expressed in terms of _PyObject_GC_TRACK macros.
 
- - Test cpyext together with the jit. Branch does not work, but it's not
-   cpyext's fault (it doesn't work even with --withoutmod-cpyext).
-
  - sort out pypy's buffer protocol. PyPy's buffer right now don't support
    raw memory (except array which supports it in a hackish way), which
    should be fixed in order to make it nicely work with cpyext.

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	Wed Apr 14 11:04:08 2010
@@ -676,6 +676,7 @@
     setup_init_functions(eci)
     copy_header_files()
 
+initfunctype = lltype.Ptr(lltype.FuncType([], lltype.Void))
 @unwrap_spec(ObjSpace, str, str)
 def load_extension_module(space, path, name):
     state = space.fromcache(State)
@@ -688,14 +689,14 @@
             "unable to load extension module '%s': %s",
             path, e.msg)
     try:
-        initfunc = dll.getpointer(
-            'init%s' % (name,), [], libffi.ffi_type_void)
+        initptr = libffi.dlsym(dll.lib, 'init%s' % (name,))
     except KeyError:
         raise operationerrfmt(
             space.w_ImportError,
             "function init%s not found in library %s",
             name, path)
-    initfunc.call(lltype.Void)
+    initfunc = rffi.cast(initfunctype, initptr)
+    generic_cpy_call(space, initfunc)
     state.check_and_raise_exception()
 
 @specialize.ll()



More information about the Pypy-commit mailing list