summaryrefslogtreecommitdiffstats
path: root/Objects/memoryobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/memoryobject.c')
-rw-r--r--Objects/memoryobject.c5
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)