Author: Armin Rigo <ar...@tunes.org> Branch: cpy-extension Changeset: r320:6c0c72f0ecb8 Date: 2012-06-14 10:09 +0200 http://bitbucket.org/cffi/cffi/changeset/6c0c72f0ecb8/
Log: More tweaks, preventing a compiler warning diff --git a/cffi/verifier.py b/cffi/verifier.py --- a/cffi/verifier.py +++ b/cffi/verifier.py @@ -332,7 +332,7 @@ else: prnt(' if (LONG_MIN <= (%s) && (%s) <= LONG_MAX)' % (name, name)) prnt(' o = PyInt_FromLong((long)(%s));' % (name,)) - prnt(' else if ((%s) < 0)' % (name,)) + prnt(' else if ((%s) <= 0)' % (name,)) prnt(' o = PyLong_FromLongLong((long long)(%s));' % (name,)) prnt(' else') prnt(' o = PyLong_FromUnsignedLongLong(' diff --git a/testing/test_verify.py b/testing/test_verify.py --- a/testing/test_verify.py +++ b/testing/test_verify.py @@ -242,13 +242,15 @@ ffi = FFI() # use 'static const int', as generally documented, although in this # case the 'static' is completely ignored. - ffi.cdef("static const int AA, BB, CC;") + ffi.cdef("static const int AA, BB, CC, DD;") lib = ffi.verify("#define AA 42\n" "#define BB (-43)\n" - "#define CC (22*2)\n") + "#define CC (22*2)\n" + "#define DD ((unsigned int)142)\n") assert lib.AA == 42 assert lib.BB == -43 assert lib.CC == 44 + assert lib.DD == 142 def test_global_const_int_size(): # integer constants: ignore the declared type, always just use the value _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit