[pypy-commit] cffi default: Bug, test, fix
arigo
noreply at buildbot.pypy.org
Sat Jul 14 18:30:44 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r644:79c684e30e94
Date: 2012-07-14 18:30 +0200
http://bitbucket.org/cffi/cffi/changeset/79c684e30e94/
Log: Bug, test, fix
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -1442,6 +1442,11 @@
negative indexes to be corrected automatically */
if (c == NULL && PyErr_Occurred())
return -1;
+ if (v == NULL) {
+ PyErr_SetString(PyExc_TypeError,
+ "'del x[n]' not supported for cdata objects");
+ return -1;
+ }
return convert_from_object(c, ctitem, v);
}
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -1563,3 +1563,9 @@
BDouble = new_primitive_type("double")
BDoubleP = new_pointer_type(BDouble)
py.test.raises(TypeError, newp, BDoubleP, "foobar")
+
+def test_bug_delitem():
+ BChar = new_primitive_type("char")
+ BCharP = new_pointer_type(BChar)
+ x = newp(BCharP)
+ py.test.raises(TypeError, "del x[0]")
More information about the pypy-commit
mailing list