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

Function dimension_from_scalar

numpy/core/src/multiarray/conversion_utils.c:87–100  ·  view source on GitHub ↗

* Convert the given value to an integer. Replaces the error when compared * to `PyArray_PyIntAsIntp`. Exists mainly to retain old behaviour of * `PyArray_IntpConverter` and `PyArray_IntpFromSequence` */

Source from the content-addressed store, hash-verified

85 * `PyArray_IntpConverter` and `PyArray_IntpFromSequence`
86 */
87static inline npy_intp
88dimension_from_scalar(PyObject *ob)
89{
90 npy_intp value = PyArray_PyIntAsIntp(ob);
91
92 if (error_converting(value)) {
93 if (PyErr_ExceptionMatches(PyExc_OverflowError)) {
94 PyErr_SetString(PyExc_ValueError,
95 "Maximum allowed dimension exceeded");
96 }
97 return -1;
98 }
99 return value;
100}
101
102/*NUMPY_API
103 * Get intp chunk from sequence

Callers 3

PyArray_IntpConverterFunction · 0.85
PyArray_IntpFromSequenceFunction · 0.85

Calls 1

PyArray_PyIntAsIntpFunction · 0.85

Tested by

no test coverage detected