| 417 | // bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3 |
| 418 | #if PY_VERSION_HEX < 0x030A00A3 |
| 419 | static inline int |
| 420 | PyModule_AddObjectRef(PyObject *module, const char *name, PyObject *value) |
| 421 | { |
| 422 | int res; |
| 423 | |
| 424 | if (!value && !PyErr_Occurred()) { |
| 425 | // PyModule_AddObject() raises TypeError in this case |
| 426 | PyErr_SetString(PyExc_SystemError, |
| 427 | "PyModule_AddObjectRef() must be called " |
| 428 | "with an exception raised if value is NULL"); |
| 429 | return -1; |
| 430 | } |
| 431 | |
| 432 | Py_XINCREF(value); |
| 433 | res = PyModule_AddObject(module, name, value); |
| 434 | if (res < 0) { |
| 435 | Py_XDECREF(value); |
| 436 | } |
| 437 | return res; |
| 438 | } |
| 439 | #endif |
| 440 | |
| 441 |
no outgoing calls
no test coverage detected