| 2185 | } |
| 2186 | |
| 2187 | static inline int |
| 2188 | PyConfig_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. |
nothing calls this directly
no test coverage detected