| 167 | } |
| 168 | |
| 169 | static PyObject * |
| 170 | array_reshape(PyArrayObject *self, PyObject *args, PyObject *kwds) |
| 171 | { |
| 172 | static char *keywords[] = {"order", NULL}; |
| 173 | PyArray_Dims newshape; |
| 174 | PyObject *ret; |
| 175 | NPY_ORDER order = NPY_CORDER; |
| 176 | Py_ssize_t n = PyTuple_Size(args); |
| 177 | |
| 178 | if (!NpyArg_ParseKeywords(kwds, "|O&", keywords, |
| 179 | PyArray_OrderConverter, &order)) { |
| 180 | return NULL; |
| 181 | } |
| 182 | |
| 183 | if (n <= 1) { |
| 184 | if (n != 0 && PyTuple_GET_ITEM(args, 0) == Py_None) { |
| 185 | return PyArray_View(self, NULL, NULL); |
| 186 | } |
| 187 | if (!PyArg_ParseTuple(args, "O&:reshape", PyArray_IntpConverter, |
| 188 | &newshape)) { |
| 189 | return NULL; |
| 190 | } |
| 191 | } |
| 192 | else { |
| 193 | if (!PyArray_IntpConverter(args, &newshape)) { |
| 194 | if (!PyErr_Occurred()) { |
| 195 | PyErr_SetString(PyExc_TypeError, |
| 196 | "invalid shape"); |
| 197 | } |
| 198 | goto fail; |
| 199 | } |
| 200 | } |
| 201 | ret = PyArray_Newshape(self, &newshape, order); |
| 202 | npy_free_cache_dim_obj(newshape); |
| 203 | return ret; |
| 204 | |
| 205 | fail: |
| 206 | npy_free_cache_dim_obj(newshape); |
| 207 | return NULL; |
| 208 | } |
| 209 | |
| 210 | static PyObject * |
| 211 | array_squeeze(PyArrayObject *self, |
nothing calls this directly
no test coverage detected