MCPcopy Create free account
hub / github.com/aio-libs/multidict / PyModule_AddObjectRef

Function PyModule_AddObjectRef

multidict/_multilib/pythoncapi_compat.h:419–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417// bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3
418#if PY_VERSION_HEX < 0x030A00A3
419static inline int
420PyModule_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

Callers 2

PyModule_AddTypeFunction · 0.85
PyModule_AddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected