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

Function PyArray_NewFromDescr

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

NUMPY_API * Generic new array creation routine. * * steals a reference to descr. On failure or when dtype->subarray is * true, dtype will be decrefed. */

Source from the content-addressed store, hash-verified

977 * true, dtype will be decrefed.
978 */
979NPY_NO_EXPORT PyObject *
980PyArray_NewFromDescr(
981 PyTypeObject *subtype, PyArray_Descr *descr,
982 int nd, npy_intp const *dims, npy_intp const *strides, void *data,
983 int flags, PyObject *obj)
984{
985 if (subtype == NULL) {
986 PyErr_SetString(PyExc_ValueError,
987 "subtype is NULL in PyArray_NewFromDescr");
988 return NULL;
989 }
990
991 if (descr == NULL) {
992 PyErr_SetString(PyExc_ValueError,
993 "descr is NULL in PyArray_NewFromDescr");
994 return NULL;
995 }
996
997 return PyArray_NewFromDescrAndBase(
998 subtype, descr,
999 nd, dims, strides, data,
1000 flags, obj, NULL);
1001}
1002
1003/*
1004 * Sets the base object using PyArray_SetBaseObject

Callers 15

array_descr_setFunction · 0.85
PyArray_NewFunction · 0.85
PyArray_FromAny_intFunction · 0.85
PyArray_EmptyFunction · 0.85
array_fromfile_binaryFunction · 0.85
array_from_textFunction · 0.85
PyArray_FromStringFunction · 0.85
PyArray_FromIterFunction · 0.85
npyiter_seq_ass_itemFunction · 0.85
PyArray_TakeFromFunction · 0.85
PyArray_RepeatFunction · 0.85

Calls 1

Tested by

no test coverage detected