Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r2359:ebcda8268d47 Date: 2015-10-22 09:31 +0200 http://bitbucket.org/cffi/cffi/changeset/ebcda8268d47/
Log: wchar_t can be signed or not, apparently, even on the same platform (arm linux) diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -756,10 +756,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 diff --git a/testing/cffi1/test_new_ffi_1.py b/testing/cffi1/test_new_ffi_1.py --- a/testing/cffi1/test_new_ffi_1.py +++ b/testing/cffi1/test_new_ffi_1.py @@ -781,10 +781,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit