NUMPY_API * Return the tuple of ordered field names from a dictionary. */
| 497 | * Return the tuple of ordered field names from a dictionary. |
| 498 | */ |
| 499 | NPY_NO_EXPORT PyObject * |
| 500 | PyArray_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. |
nothing calls this directly
no outgoing calls
no test coverage detected