diff options
Diffstat (limited to 'Objects/memoryobject.c')
-rw-r--r-- | Objects/memoryobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 7782076..2e32b2a 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -75,6 +75,11 @@ PyMemoryView_FromBuffer(Py_buffer *info) { PyMemoryViewObject *mview; + if (info->buf == NULL) { + PyErr_SetString(PyExc_ValueError, + "cannot make memory view from a buffer with a NULL data pointer"); + return NULL; + } mview = (PyMemoryViewObject *) PyObject_GC_New(PyMemoryViewObject, &PyMemoryView_Type); if (mview == NULL) |