Author: mattip <matti.pi...@gmail.com>
Branch: disable_pythonapi
Changeset: r72176:748cfaeaea89
Date: 2014-06-23 21:44 +0300
http://bitbucket.org/pypy/pypy/changeset/748cfaeaea89/

Log:    backed out changeset 8c81f5d58b5c, disable it all instead

diff --git a/pypy/module/_rawffi/alt/interp_funcptr.py 
b/pypy/module/_rawffi/alt/interp_funcptr.py
--- a/pypy/module/_rawffi/alt/interp_funcptr.py
+++ b/pypy/module/_rawffi/alt/interp_funcptr.py
@@ -312,7 +312,7 @@
 # ========================================================================
 
 class W_CDLL(W_Root):
-    def __init__(self, space, name, mode, handle = rffi.VOIDP):
+    def __init__(self, space, name, mode):
         self.flags = libffi.FUNCFLAG_CDECL
         self.space = space
         if name is None:
@@ -320,7 +320,7 @@
         else:
             self.name = name
         try:
-            self.cdll = libffi.CDLL(name, mode, handle=handle)
+            self.cdll = libffi.CDLL(name, mode)
         except DLOpenError, e:
             raise wrap_dlopenerror(space, e, self.name)
 
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -244,8 +244,10 @@
     handle = space.fromcache(State).get_pythonapi_handle()
 
     # Make a dll object with it
-    from pypy.module._rawffi.alt.interp_funcptr import W_CDLL
-    return space.wrap(W_CDLL(space, "python api", -1, handle=handle))
+    from pypy.module._rawffi.interp_rawffi import W_CDLL
+    from rpython.rlib.clibffi import RawCDLL
+    cdll = RawCDLL(handle)
+    return space.wrap(W_CDLL(space, "python api", cdll))
 
 def getsizeof(space, w_object, w_default=None):
     """Not implemented on PyPy."""
diff --git a/rpython/rlib/libffi.py b/rpython/rlib/libffi.py
--- a/rpython/rlib/libffi.py
+++ b/rpython/rlib/libffi.py
@@ -11,7 +11,7 @@
 from rpython.rlib.clibffi import FUNCFLAG_CDECL, FUNCFLAG_STDCALL, \
         AbstractFuncPtr, push_arg_as_ffiptr, c_ffi_call, FFI_TYPE_STRUCT
 from rpython.rlib.rdynload import dlopen, dlclose, dlsym, dlsym_byordinal
-from rpython.rlib.rdynload import DLLHANDLE, _WIN32
+from rpython.rlib.rdynload import DLLHANDLE
 
 import os
 
@@ -413,12 +413,9 @@
 
 # XXX: it partially duplicate the code in clibffi.py
 class CDLL(object):
-    def __init__(self, libname, mode=-1, handle=rffi.VOIDP):
+    def __init__(self, libname, mode=-1):
         """Load the library, or raises DLOpenError."""
         self.lib = rffi.cast(DLLHANDLE, 0)
-        if handle is not rffi.VOIDP :
-            self.lib = rffi.cast(DLLHANDLE, handle)
-            return
         with rffi.scoped_str2charp(libname) as ll_libname:
             self.lib = dlopen(ll_libname, mode)
 
diff --git a/rpython/rlib/test/test_libffi.py b/rpython/rlib/test/test_libffi.py
--- a/rpython/rlib/test/test_libffi.py
+++ b/rpython/rlib/test/test_libffi.py
@@ -186,24 +186,6 @@
         chain.arg(10)
         sleep.call(chain, lltype.Void, is_struct=False)
 
-    def test_dll_create(self):
-        if os.name == 'nt':
-            import sys
-            if not isinstance(sys.dllhandle, int):
-                py.test.skip('Run with cpython, not pypy')
-            dll = CDLL(None, handle=sys.dllhandle)
-        else:
-            dll = CDLL(None)
-        try:
-            # The pythonapi of the translating python
-            dll.getaddressindll('Py_OptimizeFlag')
-        except KeyError:
-            try:
-                dll.getaddressindll('PyPy_OptimizeFlag')
-            except KeyError:
-                assert False, 'could not find function in pythonapi'
-            
-
 class TestLibffiCall(BaseFfiTest):
     """
     Test various kind of calls through libffi.
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to