[pypy-svn] r75487 - in pypy/branch/fast-ctypes/pypy: module/jitffi module/jitffi/test rlib
getxsick at codespeak.net
getxsick at codespeak.net
Tue Jun 22 02:47:06 CEST 2010
Author: getxsick
Date: Tue Jun 22 02:47:04 2010
New Revision: 75487
Modified:
pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py
pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py
pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py
Log:
more tests pass. fix a problem with empty list of arguments for the calling function.
Modified: pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py (original)
+++ pypy/branch/fast-ctypes/pypy/module/jitffi/interp_jitffi.py Tue Jun 22 02:47:04 2010
@@ -32,18 +32,21 @@
self.space = space
rjitffi._Get.__init__(self, cpu, lib, func, args_type, res_type)
- def call_w(self, space, w_args):
- if self.args_type[0] == 'int':
- args_w = [ space.int_w(w_x) for w_x in space.listview(w_args) ]
- elif self.args_type[0] == 'float':
- args_w = [ space.float_w(w_x) for w_x in space.listview(w_args) ]
+ def call_w(self, space, w_args=None):
+ if space.is_w(w_args, space.w_None):
+ return space.wrap(self.call())
else:
- raise OperationError(
- space.w_TypeError,
- space.wrap('Unsupported type of argument: %s'
- % self.args_type[0]))
+ if self.args_type[0] == 'int':
+ args_w = [ space.int_w(w_x) for w_x in space.listview(w_args) ]
+ elif self.args_type[0] == 'float':
+ args_w = [ space.float_w(w_x) for w_x in space.listview(w_args) ]
+ else:
+ raise OperationError(
+ space.w_TypeError,
+ space.wrap('Unsupported type of argument: %s'
+ % self.args_type[0]))
- return self.space.wrap(self.call(args_w))
+ return space.wrap(self.call(args_w))
def descr_new_get(space, w_type, cpu, lib, func, args_type, res_type):
Modified: pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py (original)
+++ pypy/branch/fast-ctypes/pypy/module/jitffi/test/test_jitffi.py Tue Jun 22 02:47:04 2010
@@ -85,9 +85,9 @@
assert 1 == func.call()
func = lib.get('return_void', ['int', 'int'], 'void')
- assert func.call(1, 2) is None
+ assert func.call([1, 2]) is None
func = lib.get('return_void', ['int', 'int'])
- assert func.call(1, 2) is None
+ assert func.call([1, 2]) is None
def test_undefined_func(self):
import jitffi
Modified: pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py (original)
+++ pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py Tue Jun 22 02:47:04 2010
@@ -63,7 +63,10 @@
FUNC = deref(FPTR)
self.calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
- def call(self, func_args):
+ def call(self, func_args=None):
+ if func_args is None:
+ func_args = []
+
bargs = []
for tp, value in zip(self.args_type, func_args):
if tp == 'int':
More information about the Pypy-commit
mailing list