summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-16 08:20:19 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-16 08:20:19 (GMT)
commit4fe4ed2525602b03b787b013366184631926c530 (patch)
tree335ddb58426baea1054eeba8ce575cba4c7bf8ca /Python
parent6bed1c1fab3e89c459ed58f1d312de220d7c858e (diff)
downloadcpython-4fe4ed2525602b03b787b013366184631926c530.zip
cpython-4fe4ed2525602b03b787b013366184631926c530.tar.gz
cpython-4fe4ed2525602b03b787b013366184631926c530.tar.bz2
Make mktuple consistent with mklist to get rid of Coverity warnings. Also use macro version of SetItem since we know everything is setup.
Diffstat (limited to 'Python')
-rw-r--r--Python/modsupport.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index cb6bdfd..77a25ea 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -218,7 +218,7 @@ do_mklist(const char **p_format, va_list *p_va, int endchar, int n)
Py_INCREF(Py_None);
w = Py_None;
}
- PyList_SetItem(v, i, w);
+ PyList_SET_ITEM(v, i, w);
}
if (itemfailed) {
@@ -232,7 +232,6 @@ do_mklist(const char **p_format, va_list *p_va, int endchar, int n)
"Unmatched paren in format");
return NULL;
}
-
if (endchar)
++*p_format;
return v;
@@ -268,20 +267,21 @@ do_mktuple(const char **p_format, va_list *p_va, int endchar, int n)
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);
+ return NULL;
+ }
+ if (**p_format != endchar) {
Py_DECREF(v);
- v = NULL;
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;
}