NUMPY_API * Does not check for NPY_ARRAY_ENSURECOPY and NPY_ARRAY_NOTSWAPPED in flags * Steals a reference to newtype --- which can be NULL */
| 1499 | * Steals a reference to newtype --- which can be NULL |
| 1500 | */ |
| 1501 | NPY_NO_EXPORT PyObject * |
| 1502 | PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int min_depth, |
| 1503 | int max_depth, int flags, PyObject *context) |
| 1504 | { |
| 1505 | npy_dtype_info dt_info = {NULL, NULL}; |
| 1506 | |
| 1507 | int res = PyArray_ExtractDTypeAndDescriptor( |
| 1508 | newtype, &dt_info.descr, &dt_info.dtype); |
| 1509 | |
| 1510 | Py_XDECREF(newtype); |
| 1511 | |
| 1512 | if (res < 0) { |
| 1513 | Py_XDECREF(dt_info.descr); |
| 1514 | Py_XDECREF(dt_info.dtype); |
| 1515 | return NULL; |
| 1516 | } |
| 1517 | |
| 1518 | PyObject* ret = PyArray_FromAny_int(op, dt_info.descr, dt_info.dtype, |
| 1519 | min_depth, max_depth, flags, context); |
| 1520 | |
| 1521 | Py_XDECREF(dt_info.descr); |
| 1522 | Py_XDECREF(dt_info.dtype); |
| 1523 | return ret; |
| 1524 | } |
| 1525 | |
| 1526 | /* |
| 1527 | * Internal version of PyArray_FromAny that accepts a dtypemeta. Borrows |
no test coverage detected