* 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` */
| 85 | * `PyArray_IntpConverter` and `PyArray_IntpFromSequence` |
| 86 | */ |
| 87 | static inline npy_intp |
| 88 | dimension_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 |
no test coverage detected