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

Function coerce_index

numpy/core/src/multiarray/iterators.c:31–41  ·  view source on GitHub ↗

* Tries to convert 'o' into an npy_intp interpreted as an * index. Returns 1 if it was successful, 0 otherwise. Does * not set an exception. */

Source from the content-addressed store, hash-verified

29 * not set an exception.
30 */
31static int
32coerce_index(PyObject *o, npy_intp *v)
33{
34 *v = PyArray_PyIntAsIntp(o);
35
36 if ((*v) == -1 && PyErr_Occurred()) {
37 PyErr_Clear();
38 return 0;
39 }
40 return 1;
41}
42
43/*
44 * This function converts one element of the indexing tuple

Callers 1

parse_index_entryFunction · 0.85

Calls 1

PyArray_PyIntAsIntpFunction · 0.85

Tested by

no test coverage detected