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

Function PyArray_CheckFromAny

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

NUMPY_API * steals a reference to descr -- accepts NULL */

Source from the content-addressed store, hash-verified

1760 * steals a reference to descr -- accepts NULL
1761 */
1762NPY_NO_EXPORT PyObject *
1763PyArray_CheckFromAny(PyObject *op, PyArray_Descr *descr, int min_depth,
1764 int max_depth, int requires, PyObject *context)
1765{
1766 npy_dtype_info dt_info = {NULL, NULL};
1767
1768 int res = PyArray_ExtractDTypeAndDescriptor(
1769 descr, &dt_info.descr, &dt_info.dtype);
1770
1771 Py_XDECREF(descr);
1772
1773 if (res < 0) {
1774 Py_XDECREF(dt_info.descr);
1775 Py_XDECREF(dt_info.dtype);
1776 return NULL;
1777 }
1778
1779 PyObject* ret = PyArray_CheckFromAny_int(
1780 op, dt_info.descr, dt_info.dtype, min_depth, max_depth, requires,
1781 context);
1782
1783 Py_XDECREF(dt_info.descr);
1784 Py_XDECREF(dt_info.dtype);
1785 return ret;
1786}
1787
1788/*
1789 * Internal version of PyArray_CheckFromAny that accepts a dtypemeta. Borrows

Callers 3

PyArray_CheckAxisFunction · 0.85
PyArray_SearchSortedFunction · 0.85
iter_ass_subscriptFunction · 0.85

Calls 2

PyArray_CheckFromAny_intFunction · 0.85

Tested by

no test coverage detected