[pypy-commit] pypy disable_pythonapi: sys.dllhandle should be an int

mattip noreply at buildbot.pypy.org
Mon Jun 30 03:11:35 CEST 2014


Author: mattip <matti.picus at gmail.com>
Branch: disable_pythonapi
Changeset: r72275:4c96fe379073
Date: 2014-06-30 04:08 +0300
http://bitbucket.org/pypy/pypy/changeset/4c96fe379073/

Log:	sys.dllhandle should be an int

diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -205,8 +205,7 @@
         import sys
         if sys.platform != "win32" or sys.version_info < (2, 6):
             skip("Windows Python >= 2.6 only")
-        assert sys.dllhandle
-        assert sys.dllhandle.getaddressindll('cpyexttestErr_NewException')
+        assert isinstance(sys.dllhandle, int)
 
 class AppTestCpythonExtensionBase(LeakCheckingTest):
 
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
@@ -243,11 +243,14 @@
     from pypy.module.cpyext.api import State
     handle = space.fromcache(State).get_pythonapi_handle()
 
-    # Make a dll object with it
-    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))
+    # It used to be a CDLL
+    # 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))
+    # Provide a cpython-compatible int
+    from rpython.rtyper.lltypesystem import rffi
+    return space.wrap(rffi.cast(rffi.INT, handle))
 
 def getsizeof(space, w_object, w_default=None):
     """Not implemented on PyPy."""


More information about the pypy-commit mailing list