[pypy-commit] cffi default: win32 fix

arigo noreply at buildbot.pypy.org
Fri Oct 16 04:30:36 EDT 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2348:7dee2a770bc5
Date: 2015-10-16 10:24 +0200
http://bitbucket.org/cffi/cffi/changeset/7dee2a770bc5/

Log:	win32 fix

diff --git a/c/parse_c_type.c b/c/parse_c_type.c
--- a/c/parse_c_type.c
+++ b/c/parse_c_type.c
@@ -377,8 +377,12 @@
             case TOK_INTEGER:
                 errno = 0;
                 if (sizeof(length) > sizeof(unsigned long)) {
-#ifdef MS_WIN32     /* actually for win64 */
+#ifdef MS_WIN32
+# ifdef _WIN64
                     length = _strtoui64(tok->p, &endptr, 0);
+# else
+                    abort();  /* unreachable */
+# endif
 #else
                     length = strtoull(tok->p, &endptr, 0);
 #endif
diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py
--- a/testing/cffi0/test_function.py
+++ b/testing/cffi0/test_function.py
@@ -486,6 +486,9 @@
         ffi = FFI(backend=self.Backend())
         ffi.cdef("double __stdcall sin(double x);")     # stdcall ignored
         m = ffi.dlopen(lib_m)
-        assert "double(*)(double)" in str(ffi.typeof(m.sin))
+        if sys.platform == 'win32' and sys.maxint < 2**32:
+            assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin))
+        else:
+            assert "double(*)(double)" in str(ffi.typeof(m.sin))
         x = m.sin(1.23)
         assert x == math.sin(1.23)


More information about the pypy-commit mailing list