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

Function PyArray_FromAny

numpy/core/src/multiarray/ctors.c:1501–1524  ·  view source on GitHub ↗

NUMPY_API * Does not check for NPY_ARRAY_ENSURECOPY and NPY_ARRAY_NOTSWAPPED in flags * Steals a reference to newtype --- which can be NULL */

Source from the content-addressed store, hash-verified

1499 * Steals a reference to newtype --- which can be NULL
1500 */
1501NPY_NO_EXPORT PyObject *
1502PyArray_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

Callers 15

array_flat_setFunction · 0.85
array_busday_offsetFunction · 0.85
array_busday_countFunction · 0.85
array_is_busdayFunction · 0.85
array_partitionFunction · 0.85
array_argpartitionFunction · 0.85
PyArray_PutToFunction · 0.85
PyArray_PutMaskFunction · 0.85
PyArray_CompressFunction · 0.85
PyArray_AsCArrayFunction · 0.85
PyArray_InnerProductFunction · 0.85
PyArray_MatrixProduct2Function · 0.85

Calls 2

PyArray_FromAny_intFunction · 0.85

Tested by

no test coverage detected