◐ Shell
clean mode source ↗

Message 356765 - Python tracker

How do others feel about the creation of a new private API? It would keep these diffs smaller and ease refactoring... and it would probably be good to have around anyways:

/* Like PyModule_AddObject, but steals o on success AND failure. */

int
_PyModule_StealObject(PyObject *m, const char *name, PyObject *o)
{
    if (PyModule_AddObject(m, name, o) < 0) {
        Py_XDECREF(o);
        return -1;
    }
    return 0;
}