[pypy-commit] pypy default: Compatibility

arigo noreply at buildbot.pypy.org
Wed Feb 13 12:29:54 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r61174:dee788c3bc7b
Date: 2013-02-13 12:29 +0100
http://bitbucket.org/pypy/pypy/changeset/dee788c3bc7b/

Log:	Compatibility

diff --git a/pypy/module/_cffi_backend/newtype.py b/pypy/module/_cffi_backend/newtype.py
--- a/pypy/module/_cffi_backend/newtype.py
+++ b/pypy/module/_cffi_backend/newtype.py
@@ -342,8 +342,13 @@
     #
     if ((fresult.size < 0 and not isinstance(fresult, ctypevoid.W_CTypeVoid))
             or isinstance(fresult, ctypearray.W_CTypeArray)):
-        raise operationerrfmt(space.w_TypeError,
-                              "invalid result type: '%s'", fresult.name)
+        if (isinstance(fresult, ctypestruct.W_CTypeStructOrUnion) and
+                fresult.size < 0):
+            raise operationerrfmt(space.w_TypeError,
+                                  "result type '%s' is opaque", fresult.name)
+        else:
+            raise operationerrfmt(space.w_TypeError,
+                                  "invalid result type: '%s'", fresult.name)
     #
     fct = ctypefunc.W_CTypeFunc(space, fargs, fresult, ellipsis)
     return fct


More information about the pypy-commit mailing list