[pypy-commit] cffi default: Test and fix.
arigo
noreply at buildbot.pypy.org
Sat Jun 23 12:34:52 CEST 2012
Author: Armin Rigo <arigo at 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")
More information about the pypy-commit
mailing list