[issue42327] Add PyModule_Add()

STINNER Victor report at bugs.python.org
Thu Nov 12 07:58:37 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

I'm using more and more often such macro:

#define MOD_ADD(name, expr) \
    do { \
        PyObject *obj = (expr); \
        if (obj == NULL) { \
            return -1; \
        } \
        if (PyModule_AddObjectRef(mod, name, obj) < 0) { \
            Py_DECREF(obj); \
            return -1; \
        } \
        Py_DECREF(obj); \
    } while (0)

Would PyModule_Add() replace such macro?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42327>
_______________________________________


More information about the Python-bugs-list mailing list