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

Function PyModule_AddObjectRef

asyncpg/protocol/record/pythoncapi_compat.h:407–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405// bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3
406#if PY_VERSION_HEX < 0x030A00A3
407static inline int
408PyModule_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

Callers 2

PyModule_AddTypeFunction · 0.85
PyModule_AddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected