Mercurial > cpython-lru_cache-weakref
diff Python/modsupport.c @ 37025:03894a7a32ec legacy-trunk
Make mktuple consistent with mklist to get rid of Coverity warnings. Also use macro version of SetItem since we know everything is setup.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Thu, 16 Mar 2006 08:20:19 +0000 |
| parents | 7fac5d79d043 |
| children | 606818c33e50 |
line wrap: on
line diff
--- a/Python/modsupport.c Thu Mar 16 07:49:19 2006 +0000 +++ b/Python/modsupport.c Thu Mar 16 08:20:19 2006 +0000 @@ -218,7 +218,7 @@ Py_INCREF(Py_None); w = Py_None; } - PyList_SetItem(v, i, w); + PyList_SET_ITEM(v, i, w); } if (itemfailed) { @@ -232,7 +232,6 @@ "Unmatched paren in format"); return NULL; } - if (endchar) ++*p_format; return v; @@ -268,20 +267,21 @@ Py_INCREF(Py_None); w = Py_None; } - PyTuple_SetItem(v, i, w); + PyTuple_SET_ITEM(v, i, w); } - if (v != NULL && **p_format != endchar) { + if (itemfailed) { + /* do_mkvalue() should have already set an error */ Py_DECREF(v); - v = NULL; + return NULL; + } + if (**p_format != endchar) { + Py_DECREF(v); PyErr_SetString(PyExc_SystemError, "Unmatched paren in format"); + return NULL; } - else if (endchar) + if (endchar) ++*p_format; - if (itemfailed) { - Py_DECREF(v); - v = NULL; - } return v; }
