Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r494:14254c1b824c Date: 2012-06-23 12:34 +0200 http://bitbucket.org/cffi/cffi/changeset/14254c1b824c/
Log: Test and fix. diff --git a/c/_ffi_backend.c b/c/_ffi_backend.c --- a/c/_ffi_backend.c +++ b/c/_ffi_backend.c @@ -1325,7 +1325,7 @@ (ct->ct_itemdescr->ct_size <= 0)) { PyErr_Format(PyExc_TypeError, "cannot subtract cdata '%s' and cdata '%s'", - ct->ct_name, cdw->c_type->ct_name); + cdv->c_type->ct_name, ct->ct_name); return NULL; } diff = (cdv->c_data - cdw->c_data) / ct->ct_itemdescr->ct_size; diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -366,7 +366,8 @@ py.test.raises(TypeError, "p - q") py.test.raises(TypeError, "q - p") py.test.raises(TypeError, "a - q") - py.test.raises(TypeError, "q - a") + e = py.test.raises(TypeError, "q - a") + assert str(e.value) == "cannot subtract cdata 'short *' and cdata 'int *'" def test_cast_primitive_from_cdata(): p = new_primitive_type("int") _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit