[pypy-svn] pypy jitypes2: we (obviously? :-)) need to use _ffiargshape to determine the shape to use for arguments, not _ffishape. This makes (at least) test_stringptr passing
antocuni
commits-noreply at bitbucket.org
Thu Dec 30 14:13:00 CET 2010
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40279:0348eb2e297a
Date: 2010-12-30 14:08 +0100
http://bitbucket.org/pypy/pypy/changeset/0348eb2e297a/
Log: we (obviously? :-)) need to use _ffiargshape to determine the shape
to use for arguments, not _ffishape. This makes (at least)
test_stringptr passing
diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -395,29 +395,30 @@
newargs = []
# XXX: investigate the difference between _ffishape and _ffiargshape
for argtype, arg in zip(argtypes, args):
- if argtype._ffishape == 'u' or argtype._ffishape == 'c':
+ shape = argtype._ffiargshape
+ if shape == 'u' or shape == 'c':
# XXX: who should do this conversion? Maybe _ffi?
value = arg.value
assert isinstance(value, basestring) and len(value) == 1
value = ord(value)
- elif argtype._ffishape == 'P':
+ elif shape == 'P':
value = arg._get_buffer_value()
- elif argtype._ffishape == 'z':
+ elif shape == 'z':
value = arg._get_buffer_value()
- elif self._is_struct_shape(arg._ffiargshape):
+ elif self._is_struct_shape(shape):
value = arg._get_buffer_value()
else:
value = arg.value
newargs.append(value)
return newargs
- def _is_struct_shape(self, _ffishape):
+ def _is_struct_shape(self, shape):
# see the corresponding code to set the shape in _ctypes.structure._set_shape
- return (isinstance(_ffishape, tuple) and
- len(_ffishape) == 2 and
- isinstance(_ffishape[0], _rawffi.Structure) and
- _ffishape[1] == 1)
-
+ return (isinstance(shape, tuple) and
+ len(shape) == 2 and
+ isinstance(shape[0], _rawffi.Structure) and
+ shape[1] == 1)
+
def _wrap_result(self, restype, result):
"""
Convert from low-level repr of the result to the high-level python
More information about the Pypy-commit
mailing list