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

Function _subscript_by_name

numpy/core/src/multiarray/descriptor.c:3504–3518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3502}
3503
3504static PyObject *
3505_subscript_by_name(PyArray_Descr *self, PyObject *op)
3506{
3507 PyObject *obj = PyDict_GetItemWithError(self->fields, op);
3508 if (obj == NULL) {
3509 if (!PyErr_Occurred()) {
3510 PyErr_Format(PyExc_KeyError,
3511 "Field named %R not found.", op);
3512 }
3513 return NULL;
3514 }
3515 PyObject *descr = PyTuple_GET_ITEM(obj, 0);
3516 Py_INCREF(descr);
3517 return descr;
3518}
3519
3520static PyObject *
3521_subscript_by_index(PyArray_Descr *self, Py_ssize_t i)

Callers 2

_subscript_by_indexFunction · 0.85
descr_subscriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected