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

Function PyArray_FieldNames

numpy/core/src/multiarray/scalarapi.c:499–524  ·  view source on GitHub ↗

NUMPY_API * Return the tuple of ordered field names from a dictionary. */

Source from the content-addressed store, hash-verified

497 * Return the tuple of ordered field names from a dictionary.
498 */
499NPY_NO_EXPORT PyObject *
500PyArray_FieldNames(PyObject *fields)
501{
502 PyObject *tup;
503 PyObject *ret;
504 PyObject *_numpy_internal;
505
506 if (!PyDict_Check(fields)) {
507 PyErr_SetString(PyExc_TypeError,
508 "Fields must be a dictionary");
509 return NULL;
510 }
511 _numpy_internal = PyImport_ImportModule("numpy.core._internal");
512 if (_numpy_internal == NULL) {
513 return NULL;
514 }
515 tup = PyObject_CallMethod(_numpy_internal, "_makenames_list", "OO", fields, Py_False);
516 Py_DECREF(_numpy_internal);
517 if (tup == NULL) {
518 return NULL;
519 }
520 ret = PyTuple_GET_ITEM(tup, 0);
521 ret = PySequence_Tuple(ret);
522 Py_DECREF(tup);
523 return ret;
524}
525
526/*NUMPY_API
527 * Return descr object from array scalar.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected