[pypy-svn] pypy jitypes2: merge heads

antocuni commits-noreply at bitbucket.org
Fri Mar 25 15:07:39 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r42936:a0dfeec2f19a
Date: 2011-03-25 15:06 +0100
http://bitbucket.org/pypy/pypy/changeset/a0dfeec2f19a/

Log:	merge heads

diff --git a/lib_pypy/_ctypes/basics.py b/lib_pypy/_ctypes/basics.py
--- a/lib_pypy/_ctypes/basics.py
+++ b/lib_pypy/_ctypes/basics.py
@@ -50,6 +50,11 @@
     def get_ffi_param(self, value):
         return self.from_param(value)._to_ffi_param()
 
+    def get_ffi_argtype(self):
+        if self._ffiargtype:
+            return self._ffiargtype
+        return _shape_to_ffi_type(self._ffiargshape)
+
     def _CData_output(self, resbuffer, base=None, index=-1):
         #assert isinstance(resbuffer, _rawffi.ArrayInstance)
         """Used when data exits ctypes and goes into user code.
@@ -103,6 +108,7 @@
     """
     __metaclass__ = _CDataMeta
     _objects = None
+    _ffiargtype = None
 
     def __init__(self, *args, **kwds):
         raise TypeError("%s has no type" % (type(self),))
@@ -181,9 +187,9 @@
             isinstance(shape[0], _rawffi.Structure) and
             shape[1] == 1)
 
-def shape_to_ffi_type(shape):
+def _shape_to_ffi_type(shape):
     try:
-        return shape_to_ffi_type.typemap[shape]
+        return _shape_to_ffi_type.typemap[shape]
     except KeyError:
         pass
     if is_struct_shape(shape):
@@ -192,7 +198,7 @@
     assert False, 'unknown shape %s' % (shape,)
 
 
-shape_to_ffi_type.typemap =  {
+_shape_to_ffi_type.typemap =  {
     'c' : _ffi.types.char,
     'b' : _ffi.types.sbyte,
     'B' : _ffi.types.ubyte,


More information about the Pypy-commit mailing list