[pypy-commit] pypy rffi-parser-2: Handle pointers to primitive types and fixed-size arrays

rlamy pypy.commits at gmail.com
Fri Dec 23 17:45:14 EST 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: rffi-parser-2
Changeset: r89217:2d79420b0e58
Date: 2016-12-18 01:24 +0000
http://bitbucket.org/pypy/pypy/changeset/2d79420b0e58/

Log:	Handle pointers to primitive types and fixed-size arrays

diff --git a/pypy/module/cpyext/cparser.py b/pypy/module/cpyext/cparser.py
--- a/pypy/module/cpyext/cparser.py
+++ b/pypy/module/cpyext/cparser.py
@@ -730,6 +730,8 @@
             TO = self.convert_type(obj.totype)
             if TO is lltype.Void:
                 return rffi.VOIDP
+            elif isinstance(obj.totype, model.PrimitiveType):
+                return rffi.CArrayPtr(TO)
             return lltype.Ptr(TO)
         elif isinstance(obj, model.FunctionPtrType):
             if obj.ellipsis:
@@ -739,6 +741,8 @@
             return lltype.Ptr(lltype.FuncType(args, res))
         elif isinstance(obj, model.VoidType):
             return lltype.Void
+        elif isinstance(obj, model.ArrayType):
+            return rffi.CFixedArray(self.convert_type(obj.item), obj.length)
         else:
             raise NotImplementedError
 


More information about the pypy-commit mailing list