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

Function PyConfig_GetInt

asyncpg/protocol/record/pythoncapi_compat.h:2187–2211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2185}
2186
2187static inline int
2188PyConfig_GetInt(const char *name, int *value)
2189{
2190 PyObject *obj = PyConfig_Get(name);
2191 if (obj == NULL) {
2192 return -1;
2193 }
2194
2195 if (!PyLong_Check(obj)) {
2196 Py_DECREF(obj);
2197 PyErr_Format(PyExc_TypeError, "config option %s is not an int", name);
2198 return -1;
2199 }
2200
2201 int as_int = PyLong_AsInt(obj);
2202 Py_DECREF(obj);
2203 if (as_int == -1 && PyErr_Occurred()) {
2204 PyErr_Format(PyExc_OverflowError,
2205 "config option %s value does not fit into a C int", name);
2206 return -1;
2207 }
2208
2209 *value = as_int;
2210 return 0;
2211}
2212#endif // PY_VERSION_HEX > 0x03090000 && !defined(PYPY_VERSION)
2213
2214// gh-133144 added PyUnstable_Object_IsUniquelyReferenced() to Python 3.14.0b1.

Callers

nothing calls this directly

Calls 2

PyConfig_GetFunction · 0.85
PyLong_AsIntFunction · 0.85

Tested by

no test coverage detected