diff options
author | Pierre Glaser <pierreglaser@msn.com> | 2018-10-05 13:09:00 +0200 |
---|---|---|
committer | Pierre Glaser <pierreglaser@msn.com> | 2018-10-05 13:09:00 +0200 |
commit | 0fa036abe0afb89d7b15e3b763252bff37659fd0 (patch) | |
tree | f4d74b185b9081a00b4e8ebef80f0f4099bb652a /numpy | |
parent | 5f3c0c2ba7f0c794a483c7e74722f95bdd3bb827 (diff) | |
download | numpy-0fa036abe0afb89d7b15e3b763252bff37659fd0.tar.gz |
added protocol kw to c implementations of array_dump[s]
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/methods.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c index cb63c7f74..b8fb58e70 100644 --- a/numpy/core/src/multiarray/methods.c +++ b/numpy/core/src/multiarray/methods.c @@ -1920,15 +1920,18 @@ PyArray_Dumps(PyObject *self, int protocol) static PyObject * -array_dump(PyArrayObject *self, PyObject *args) +array_dump(PyArrayObject *self, PyObject *args, PyObject *kwds) { PyObject *file = NULL; + int protocol = 2; + static char *kwlist[] = {"file", "protocol", NULL}; int ret; - if (!PyArg_ParseTuple(args, "O:dump", &file)) { + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|i:dump", kwlist, + &file, &protocol)) { return NULL; } - ret = PyArray_Dump((PyObject *)self, file, 2); + ret = PyArray_Dump((PyObject *)self, file, protocol); if (ret < 0) { return NULL; } @@ -1937,12 +1940,16 @@ array_dump(PyArrayObject *self, PyObject *args) static PyObject * -array_dumps(PyArrayObject *self, PyObject *args) +array_dumps(PyArrayObject *self, PyObject *args, PyObject *kwds) { - if (!PyArg_ParseTuple(args, "")) { + int protocol = 2; + static char *kwlist[] = {"protocol", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:dumps", kwlist, + &protocol)) { return NULL; } - return PyArray_Dumps((PyObject *)self, 2); + return PyArray_Dumps((PyObject *)self, protocol); } @@ -2512,10 +2519,10 @@ NPY_NO_EXPORT PyMethodDef array_methods[] = { METH_VARARGS, NULL}, {"dumps", (PyCFunction) array_dumps, - METH_VARARGS, NULL}, + METH_VARARGS | METH_KEYWORDS, NULL}, {"dump", (PyCFunction) array_dump, - METH_VARARGS, NULL}, + METH_VARARGS | METH_KEYWORDS, NULL}, {"__complex__", (PyCFunction) array_complex, |