[pypy-commit] cffi default: Ignore mismatches between two different primitive types of the same size,

arigo noreply at buildbot.pypy.org
Sat Mar 30 18:09:42 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1210:3c66c29d2e80
Date: 2013-03-30 19:08 +0200
http://bitbucket.org/cffi/cffi/changeset/3c66c29d2e80/

Log:	Ignore mismatches between two different primitive types of the same
	size, like on some platforms "double" and "long double".

diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -425,13 +425,18 @@
 
 def _check_field_match(typename, real, expect_mismatch):
     ffi = FFI()
-    if expect_mismatch == 'by_size':
+    testing_by_size = (expect_mismatch == 'by_size')
+    if testing_by_size:
         expect_mismatch = ffi.sizeof(typename) != ffi.sizeof(real)
     ffi.cdef("struct foo_s { %s x; ...; };" % typename)
     try:
         ffi.verify("struct foo_s { %s x; };" % real)
     except VerificationError:
         if not expect_mismatch:
+            if testing_by_size:
+                print("ignoring mismatch between %s* and %s* even though "
+                      "they have the same size" % (typename, real))
+                return
             raise AssertionError("unexpected mismatch: %s should be accepted "
                                  "as equal to %s" % (typename, real))
     else:


More information about the pypy-commit mailing list