summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.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 /Modules/_testcapimodule.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 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index f326568..f19d0df 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2231,6 +2231,15 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs)
return PyErr_NewExceptionWithDoc(name, doc, base, dict);
}
+static PyObject *
+make_memoryview_from_NULL_pointer(PyObject *self)
+{
+ Py_buffer info;
+ if (PyBuffer_FillInfo(&info, NULL, NULL, 1, 1, PyBUF_FULL_RO) < 0)
+ return NULL;
+ return PyMemoryView_FromBuffer(&info);
+}
+
/* Test that the fatal error from not having a current thread doesn't
cause an infinite loop. Run via Lib/test/test_capi.py */
static PyObject *
@@ -2326,6 +2335,8 @@ static PyMethodDef TestMethods[] = {
{"code_newempty", code_newempty, METH_VARARGS},
{"make_exception_with_doc", (PyCFunction)make_exception_with_doc,
METH_VARARGS | METH_KEYWORDS},
+ {"make_memoryview_from_NULL_pointer", (PyCFunction)make_memoryview_from_NULL_pointer,
+ METH_NOARGS},
{"crash_no_current_thread", (PyCFunction)crash_no_current_thread, METH_NOARGS},
{NULL, NULL} /* sentinel */
};