diff options
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r-- | Modules/pyexpat.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 33a56c5..d8395e9 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1656,8 +1656,7 @@ add_submodule(PyObject *mod, const char *fullname) Py_DECREF(mod_name); /* gives away the reference to the submodule */ - if (PyModule_AddObject(mod, name, submodule) < 0) { - Py_DECREF(submodule); + if (PyModule_Add(mod, name, submodule) < 0) { return NULL; } @@ -1887,10 +1886,7 @@ add_features(PyObject *mod) goto error; } } - if (PyModule_AddObject(mod, "features", list) < 0) { - goto error; - } - return 0; + return PyModule_Add(mod, "features", list); error: Py_DECREF(list); @@ -1959,8 +1955,7 @@ pyexpat_exec(PyObject *mod) info.major, info.minor, info.micro); - if (PyModule_AddObject(mod, "version_info", versionInfo) < 0) { - Py_DECREF(versionInfo); + if (PyModule_Add(mod, "version_info", versionInfo) < 0) { return -1; } } @@ -2040,8 +2035,7 @@ pyexpat_exec(PyObject *mod) return -1; } - if (PyModule_AddObject(mod, "expat_CAPI", capi_object) < 0) { - Py_DECREF(capi_object); + if (PyModule_Add(mod, "expat_CAPI", capi_object) < 0) { return -1; } |