| 405 | // bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3 |
| 406 | #if PY_VERSION_HEX < 0x030A00A3 |
| 407 | static inline int |
| 408 | PyModule_AddObjectRef(PyObject *module, const char *name, PyObject *value) |
| 409 | { |
| 410 | int res; |
| 411 | |
| 412 | if (!value && !PyErr_Occurred()) { |
| 413 | // PyModule_AddObject() raises TypeError in this case |
| 414 | PyErr_SetString(PyExc_SystemError, |
| 415 | "PyModule_AddObjectRef() must be called " |
| 416 | "with an exception raised if value is NULL"); |
| 417 | return -1; |
| 418 | } |
| 419 | |
| 420 | Py_XINCREF(value); |
| 421 | res = PyModule_AddObject(module, name, value); |
| 422 | if (res < 0) { |
| 423 | Py_XDECREF(value); |
| 424 | } |
| 425 | return res; |
| 426 | } |
| 427 | #endif |
| 428 | |
| 429 |
no outgoing calls
no test coverage detected