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

Function PyArray_PyIntAsInt_ErrMsg

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

Source from the content-addressed store, hash-verified

953*****************************/
954
955static int
956PyArray_PyIntAsInt_ErrMsg(PyObject *o, const char * msg)
957{
958 npy_intp long_value;
959 /* This assumes that NPY_SIZEOF_INTP >= NPY_SIZEOF_INT */
960 long_value = PyArray_PyIntAsIntp_ErrMsg(o, msg);
961
962#if (NPY_SIZEOF_INTP > NPY_SIZEOF_INT)
963 if ((long_value < INT_MIN) || (long_value > INT_MAX)) {
964 PyErr_SetString(PyExc_ValueError, "integer won't fit into a C int");
965 return -1;
966 }
967#endif
968 return (int) long_value;
969}
970
971/*NUMPY_API*/
972NPY_NO_EXPORT int

Callers 3

PyArray_AxisConverterFunction · 0.85
PyArray_ConvertMultiAxisFunction · 0.85
PyArray_PyIntAsIntFunction · 0.85

Calls 1

Tested by

no test coverage detected