Issue #9737: Fix a crash when trying to delete a slice or an item from
a memoryview object.
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index 6ca23fc..8e56df9 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -111,6 +111,15 @@
         m = None
         self.assertEquals(sys.getrefcount(b), oldrefcount)
 
+    def test_delitem(self):
+        for tp in self._types:
+            b = tp(self._source)
+            m = self._view(b)
+            with self.assertRaises(TypeError):
+                del m[1]
+            with self.assertRaises(TypeError):
+                del m[1:4]
+
     def test_tobytes(self):
         for tp in self._types:
             m = self._view(tp(self._source))
diff --git a/Misc/NEWS b/Misc/NEWS
index 2a959a4..92d858a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #9737: Fix a crash when trying to delete a slice or an item from
+  a memoryview object.
+
 - Issue #9549: sys.setdefaultencoding() and PyUnicode_SetDefaultEncoding()
   are now removed, since their effect was inexistent in 3.x (the default
   encoding is hardcoded to utf-8 and cannot be changed).
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index 9a62dd8..3f20392 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -631,6 +631,11 @@
             "cannot modify read-only memory");
         return -1;
     }
+    if (value == NULL) {
+        PyErr_SetString(PyExc_TypeError,
+                        "cannot delete memory");
+        return -1;
+    }
     if (view->ndim != 1) {
         PyErr_SetNone(PyExc_NotImplementedError);
         return -1;