| 899 | // gh-108445 added PyLong_AsInt() to Python 3.13.0a1 |
| 900 | #if PY_VERSION_HEX < 0x030D00A1 |
| 901 | static inline int PyLong_AsInt(PyObject *obj) |
| 902 | { |
| 903 | #ifdef PYPY_VERSION |
| 904 | long value = PyLong_AsLong(obj); |
| 905 | if (value == -1 && PyErr_Occurred()) { |
| 906 | return -1; |
| 907 | } |
| 908 | if (value < (long)INT_MIN || (long)INT_MAX < value) { |
| 909 | PyErr_SetString(PyExc_OverflowError, |
| 910 | "Python int too large to convert to C int"); |
| 911 | return -1; |
| 912 | } |
| 913 | return (int)value; |
| 914 | #else |
| 915 | return _PyLong_AsInt(obj); |
| 916 | #endif |
| 917 | } |
| 918 | #endif |
| 919 | |
| 920 |
no outgoing calls
no test coverage detected