[pypy-svn] pypy jitypes2: try to make is_struct an annotation-time constant
antocuni
commits-noreply at bitbucket.org
Mon Dec 27 20:45:07 CET 2010
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40246:97f382c41477
Date: 2010-12-27 20:37 +0100
http://bitbucket.org/pypy/pypy/changeset/97f382c41477/
Log: try to make is_struct an annotation-time constant
diff --git a/pypy/module/_ffi/interp_ffi.py b/pypy/module/_ffi/interp_ffi.py
--- a/pypy/module/_ffi/interp_ffi.py
+++ b/pypy/module/_ffi/interp_ffi.py
@@ -172,13 +172,16 @@
# handled by the ULONG case).
restype = self.func.restype
call = self.func.call
- is_struct = libffi.types.is_struct(restype)
if restype is libffi.types.ulong:
# special case
uintres = call(argchain, rffi.ULONG)
return space.wrap(uintres)
- elif restype is libffi.types.pointer or is_struct:
- ptrres = call(argchain, rffi.VOIDP, is_struct=is_struct)
+ elif restype is libffi.types.pointer:
+ ptrres = call(argchain, rffi.VOIDP)
+ uintres = rffi.cast(rffi.ULONG, ptrres)
+ return space.wrap(uintres)
+ elif libffi.types.is_struct(restype):
+ ptrres = call(argchain, rffi.VOIDP, is_struct=True)
uintres = rffi.cast(rffi.ULONG, ptrres)
return space.wrap(uintres)
elif restype is libffi.types.uint:
More information about the Pypy-commit
mailing list