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

Function _descr_find_object

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

* returns NPY_OBJECT_DTYPE_FLAGS if this data-type has an object portion used * when setting the state because hasobject is not stored. */

Source from the content-addressed store, hash-verified

2720 * when setting the state because hasobject is not stored.
2721 */
2722static char
2723_descr_find_object(PyArray_Descr *self)
2724{
2725 if (self->flags
2726 || self->type_num == NPY_OBJECT
2727 || self->kind == 'O') {
2728 return NPY_OBJECT_DTYPE_FLAGS;
2729 }
2730 if (PyDataType_HASFIELDS(self)) {
2731 PyObject *key, *value, *title = NULL;
2732 PyArray_Descr *new;
2733 int offset;
2734 Py_ssize_t pos = 0;
2735
2736 while (PyDict_Next(self->fields, &pos, &key, &value)) {
2737 if (NPY_TITLE_KEY(key, value)) {
2738 continue;
2739 }
2740 if (!PyArg_ParseTuple(value, "Oi|O", &new, &offset, &title)) {
2741 PyErr_Clear();
2742 return 0;
2743 }
2744 if (_descr_find_object(new)) {
2745 new->flags = NPY_OBJECT_DTYPE_FLAGS;
2746 return NPY_OBJECT_DTYPE_FLAGS;
2747 }
2748 }
2749 }
2750 return 0;
2751}
2752
2753/*
2754 * state is at least byteorder, subarray, and fields but could include elsize

Callers 1

arraydescr_setstateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected