summaryrefslogtreecommitdiffstats
path: root/Objects/memoryobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-02-24 20:53:48 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-02-24 20:53:48 (GMT)
commit915605c59a82ca0f0015c4deec40b3e211ccb0c1 (patch)
treeab036ac0f497a40d837148444ff2d17cd32787dd /Objects/memoryobject.c
parentec8f0df2296cfb88cd932eeb053edaa316600725 (diff)
downloadcpython-915605c59a82ca0f0015c4deec40b3e211ccb0c1.zip
cpython-915605c59a82ca0f0015c4deec40b3e211ccb0c1.tar.gz
cpython-915605c59a82ca0f0015c4deec40b3e211ccb0c1.tar.bz2
Merged revisions 88550 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r88550 | antoine.pitrou | 2011-02-24 21:50:49 +0100 (jeu., 24 févr. 2011) | 4 lines Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with a buffer struct having a NULL data pointer. ........
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)