[pypy-commit] cffi cffi-1.0: Windows fixes

arigo noreply at buildbot.pypy.org
Sun May 3 19:52:06 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1911:f7ee4bd43b8d
Date: 2015-05-03 19:52 +0200
http://bitbucket.org/cffi/cffi/changeset/f7ee4bd43b8d/

Log:	Windows fixes

diff --git a/_cffi1/recompiler.py b/_cffi1/recompiler.py
--- a/_cffi1/recompiler.py
+++ b/_cffi1/recompiler.py
@@ -842,6 +842,8 @@
               call_c_compiler=True, **kwds):
     if not isinstance(module_name, str):
         module_name = module_name.encode('ascii')
+    if ffi._windows_unicode:
+        ffi._apply_windows_unicode(kwds)
     c_file = os.path.join(tmpdir, module_name + '.c')
     ext = _get_extension(module_name, c_file, kwds)
     updated = make_c_source(ffi, module_name, preamble, c_file)
diff --git a/_cffi1/setuptools_ext.py b/_cffi1/setuptools_ext.py
--- a/_cffi1/setuptools_ext.py
+++ b/_cffi1/setuptools_ext.py
@@ -34,6 +34,9 @@
         error("%r: the set_source() method was not called" % (mod_spec,))
     module_name = ffi._recompiler_module_name
     source, kwds = ffi._assigned_source
+    if ffi._windows_unicode:
+        kwds = kwds.copy()
+        ffi._apply_windows_unicode(kwds)
 
     allsources = ['$PLACEHOLDER']
     allsources.extend(kwds.get('sources', []))
diff --git a/_cffi1/test_verify1.py b/_cffi1/test_verify1.py
--- a/_cffi1/test_verify1.py
+++ b/_cffi1/test_verify1.py
@@ -1721,7 +1721,8 @@
         assert lib.AA == 0
         assert lib.BB == eval(hidden_value.replace('U', '').replace('L', ''))
         assert ffi.sizeof("enum foo_e") == expected_size
-        assert int(ffi.cast("enum foo_e", -1)) == expected_minus1
+        if sys.platform != 'win32':
+            assert int(ffi.cast("enum foo_e", -1)) == expected_minus1
     # test with the large value hidden:
     # disabled so far, doesn't work
 ##    for hidden_value, expected_size, expected_minus1 in cases:
@@ -2146,6 +2147,7 @@
     assert lib.ABA == 42
 
 def test_implicit_unicode_on_windows():
+    from cffi import FFIError
     if sys.platform != 'win32':
         py.test.skip("win32-only test")
     ffi = FFI()


More information about the pypy-commit mailing list