Author: Ronan Lamy <[email protected]>
Branch: rffi-parser
Changeset: r89132:5d78c74e573b
Date: 2016-12-18 02:56 +0000
http://bitbucket.org/pypy/pypy/changeset/5d78c74e573b/
Log: Handle FILE*
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
@@ -3,6 +3,7 @@
from cffi.commontypes import COMMON_TYPES, resolve_common_type
import pycparser
import weakref, re
+from rpython.rlib.rfile import FILEP
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rtyper.tool import rfficache, rffi_platform
@@ -644,7 +645,7 @@
CNAME_TO_LLTYPE = {
'char': rffi.CHAR,
'double': rffi.DOUBLE, 'long double': rffi.LONGDOUBLE,
- 'float': rffi.FLOAT}
+ 'float': rffi.FLOAT, 'FILE': FILEP.TO}
def add_inttypes():
for name in rffi.TYPES:
@@ -695,6 +696,8 @@
self.macros[name] = value
def new_struct(self, obj):
+ if obj.name == '_IO_FILE': # cffi weirdness
+ return cname_to_lltype('FILE')
struct = DelayedStruct(obj.name, None, lltype.ForwardReference())
# Cache it early, to avoid infinite recursion
self.structs[obj] = struct
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit