[pypy-svn] pypy real-voidp: Fix more tests

amauryfa commits-noreply at bitbucket.org
Tue Mar 1 01:23:02 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: real-voidp
Changeset: r42355:f3d6a0cabcca
Date: 2011-03-01 01:22 +0100
http://bitbucket.org/pypy/pypy/changeset/f3d6a0cabcca/

Log:	Fix more tests

diff --git a/pypy/translator/c/node.py b/pypy/translator/c/node.py
--- a/pypy/translator/c/node.py
+++ b/pypy/translator/c/node.py
@@ -337,8 +337,6 @@
         self.varlength = varlength
         self.dependencies = {}
         contained_type = ARRAY.OF
-        if ARRAY._hints.get("render_as_void"):
-            contained_type = Void
         self.itemtypename = db.gettype(contained_type, who_asks=self)
         self.fulltypename = self.itemtypename.replace('@', '(@)[%d]' %
                                                       (self.varlength,))
@@ -683,6 +681,8 @@
 
     def getptrname(self):
         if barebonearray(self.getTYPE()):
+            if self.getTYPE()._hints.get("render_as_void"):
+                return '(void *)%s' % self.name
             return self.name
         return ContainerNode.getptrname(self)
 

diff --git a/pypy/rlib/libffi.py b/pypy/rlib/libffi.py
--- a/pypy/rlib/libffi.py
+++ b/pypy/rlib/libffi.py
@@ -6,6 +6,7 @@
 from pypy.rlib.clibffi import get_libc_name, FUNCFLAG_CDECL, AbstractFuncPtr, \
     push_arg_as_ffiptr, c_ffi_call
 from pypy.rlib.rdynload import dlopen, dlclose, dlsym, dlsym_byordinal
+from pypy.rlib.rdynload import DLLHANDLE
 
 class types(object):
     """
@@ -286,7 +287,7 @@
 class CDLL(object):
     def __init__(self, libname):
         """Load the library, or raises DLOpenError."""
-        self.lib = lltype.nullptr(rffi.CCHARP.TO)
+        self.lib = rffi.cast(DLLHANDLE, 0)
         ll_libname = rffi.str2charp(libname)
         try:
             self.lib = dlopen(ll_libname)
@@ -296,7 +297,7 @@
     def __del__(self):
         if self.lib:
             dlclose(self.lib)
-            self.lib = lltype.nullptr(rffi.CCHARP.TO)
+            self.lib = rffi.cast(DLLHANDLE, 0)
 
     def getpointer(self, name, argtypes, restype, flags=FUNCFLAG_CDECL):
         return Func(name, argtypes, restype, dlsym(self.lib, name),


More information about the Pypy-commit mailing list