Commits

Armin Rigo  committed 79c684e

Bug, test, fix

  • Participants
  • Parent commits 04d5aa6

Comments (0)

Files changed (2)

File c/_cffi_backend.c

        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);
 }
 
     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]")