MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / PyLong_AsInt

Function PyLong_AsInt

asyncpg/protocol/record/pythoncapi_compat.h:901–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899// gh-108445 added PyLong_AsInt() to Python 3.13.0a1
900#if PY_VERSION_HEX < 0x030D00A1
901static 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

Callers 2

PyLong_AsInt32Function · 0.85
PyConfig_GetIntFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected