[pypy-svn] r75129 - in pypy/branch/fast-ctypes/pypy/rlib: . test

getxsick at codespeak.net getxsick at codespeak.net
Sat Jun 5 18:46:53 CEST 2010


Author: getxsick
Date: Sat Jun  5 18:46:51 2010
New Revision: 75129

Modified:
   pypy/branch/fast-ctypes/pypy/rlib/jitffi.py
   pypy/branch/fast-ctypes/pypy/rlib/test/test_jitffi.py
Log:
there is no more 'void' as a function argument.
use empty list of args instead


Modified: pypy/branch/fast-ctypes/pypy/rlib/jitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/jitffi.py	(original)
+++ pypy/branch/fast-ctypes/pypy/rlib/jitffi.py	Sat Jun  5 18:46:51 2010
@@ -80,13 +80,11 @@
 class _Get(object):
     def __init__(self, cpu, lib, func, args_type, res_type='void'):
         assert isinstance(args_type, list)
-        if 'void' in args_type and len(args_type) > 1:
-            raise ValueError("'void' must be the only parameter")
         self.args_type = args_type
         self.res_type = res_type
         self.cpu = cpu
         self.lib = lib
-        # XXX add 'void' handling
+
         if self.res_type == 'int':
             self.bres = BoxInt()
             res = lltype.Signed
@@ -116,8 +114,6 @@
                 args.append(lltype.Float)
             elif arg == 'ref':
                 args.append(lltype.Signed)
-            elif arg == 'void':
-                break
             else:
                 raise ValueError(arg)
 
@@ -134,8 +130,6 @@
                 bargs.append(BoxFloat(value))
             elif tp == 'ref':
                 bargs.append(BoxPtr(value))
-            elif tp == 'void':
-                break
         inputargs = [self.bfuncaddr] + bargs
 
         oplist = [ResOperation(rop.CALL, inputargs, self.bres,

Modified: pypy/branch/fast-ctypes/pypy/rlib/test/test_jitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/test/test_jitffi.py	(original)
+++ pypy/branch/fast-ctypes/pypy/rlib/test/test_jitffi.py	Sat Jun  5 18:46:51 2010
@@ -1,6 +1,7 @@
 from pypy.rlib import jitffi
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.translator.platform import platform
+from pypy.rpython.lltypesystem import rffi, lltype
 
 import py
 
@@ -97,11 +98,7 @@
     def test_get_void(self):
         lib = jitffi.CDLL(self.lib_name)
 
-        py.test.raises(ValueError, lib.get,
-                       'add_integers', ['void', 'int'], 'int')
-
-        func = lib.get('fvoid', ['void'], 'int')
-        assert 1 == func('void')
+        func = lib.get('fvoid', [], 'int')
         assert 1 == func()
 
         func = lib.get('return_void', ['int', 'int'], 'void')



More information about the Pypy-commit mailing list