| 2375 | |
| 2376 | |
| 2377 | static PyObject * |
| 2378 | array_transpose(PyArrayObject *self, PyObject *args) |
| 2379 | { |
| 2380 | PyObject *shape = Py_None; |
| 2381 | Py_ssize_t n = PyTuple_Size(args); |
| 2382 | PyArray_Dims permute; |
| 2383 | PyObject *ret; |
| 2384 | |
| 2385 | if (n > 1) { |
| 2386 | shape = args; |
| 2387 | } |
| 2388 | else if (n == 1) { |
| 2389 | shape = PyTuple_GET_ITEM(args, 0); |
| 2390 | } |
| 2391 | |
| 2392 | if (shape == Py_None) { |
| 2393 | ret = PyArray_Transpose(self, NULL); |
| 2394 | } |
| 2395 | else { |
| 2396 | if (!PyArray_IntpConverter(shape, &permute)) { |
| 2397 | return NULL; |
| 2398 | } |
| 2399 | ret = PyArray_Transpose(self, &permute); |
| 2400 | npy_free_cache_dim_obj(permute); |
| 2401 | } |
| 2402 | |
| 2403 | return ret; |
| 2404 | } |
| 2405 | |
| 2406 | #define _CHKTYPENUM(typ) ((typ) ? (typ)->type_num : NPY_NOTYPE) |
| 2407 |
nothing calls this directly
no test coverage detected