MCPcopy Create free account
hub / github.com/numpy/numpy / _getlist_pkl

Function _getlist_pkl

numpy/core/src/multiarray/methods.c:1766–1791  ·  view source on GitHub ↗

Convert Array to flat list (using getitem) */

Source from the content-addressed store, hash-verified

1764
1765/* Convert Array to flat list (using getitem) */
1766static PyObject *
1767_getlist_pkl(PyArrayObject *self)
1768{
1769 PyObject *theobject;
1770 PyArrayIterObject *iter = NULL;
1771 PyObject *list;
1772 PyArray_GetItemFunc *getitem;
1773
1774 getitem = PyArray_DESCR(self)->f->getitem;
1775 iter = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);
1776 if (iter == NULL) {
1777 return NULL;
1778 }
1779 list = PyList_New(iter->size);
1780 if (list == NULL) {
1781 Py_DECREF(iter);
1782 return NULL;
1783 }
1784 while (iter->index < iter->size) {
1785 theobject = getitem(iter->dataptr, self);
1786 PyList_SET_ITEM(list, iter->index, theobject);
1787 PyArray_ITER_NEXT(iter);
1788 }
1789 Py_DECREF(iter);
1790 return list;
1791}
1792
1793static int
1794_setlist_pkl(PyArrayObject *self, PyObject *list)

Callers 1

array_reduceFunction · 0.85

Calls 2

PyArray_DESCRFunction · 0.85
PyArray_IterNewFunction · 0.85

Tested by

no test coverage detected