mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fixed memoryview constructor. It allowed arbitrary keyword arguments. The bug was found by mykhal from #python. I've also added a small test case in the new test_memoryview.py
This commit is contained in:
parent
c1bdbc316d
commit
7b6fc8e19d
2 changed files with 33 additions and 3 deletions
|
@ -69,10 +69,15 @@ PyMemoryView_FromObject(PyObject *base)
|
|||
static PyObject *
|
||||
memory_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyObject *obj;
|
||||
if (!PyArg_UnpackTuple(args, "memoryview", 1, 1, &obj)) return NULL;
|
||||
PyObject *obj;
|
||||
static char *kwlist[] = {"object", 0};
|
||||
|
||||
return PyMemoryView_FromObject(obj);
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:memoryview", kwlist,
|
||||
&obj)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyMemoryView_FromObject(obj);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue