Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r478:a877c860125f Date: 2012-06-20 18:31 +0200 http://bitbucket.org/cffi/cffi/changeset/a877c860125f/
Log: Tests, missing case. diff --git a/c/_ffi_backend.c b/c/_ffi_backend.c --- a/c/_ffi_backend.c +++ b/c/_ffi_backend.c @@ -1969,6 +1969,9 @@ } value = (unsigned char)PyString_AS_STRING(io)[0]; } + else if (io == Py_None) { + value = 0.0; + } else { value = PyFloat_AsDouble(io); } diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -114,6 +114,9 @@ assert cast(p, -1.1) != cast(p, -1.1) assert repr(float(cast(p, -0.0))) == '-0.0' + assert float(cast(p, '\x09')) == 9.0 + assert float(cast(p, True)) == 1.0 + assert float(cast(p, None)) == 0.0 def test_character_type(): p = new_primitive_type("char") _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit