summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-10-27 05:50:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-10-27 05:50:39 (GMT)
commit077f574db1b76484690fd46ddf342ec7e80f929a (patch)
tree3020beca10900040aafca12fa36adb400af27532 /Python/getargs.c
parent61dde63e3bdcdca9e352ec91442137e9ace5f75d (diff)
downloadcpython-077f574db1b76484690fd46ddf342ec7e80f929a.zip
cpython-077f574db1b76484690fd46ddf342ec7e80f929a.tar.gz
cpython-077f574db1b76484690fd46ddf342ec7e80f929a.tar.bz2
vgetargskeywords: The keywords arg is a dict (if non-NULL), so use the
dict API everywhere on it instead of sometimes using the slower mapping API.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index a68940a..5c78dd7 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1090,7 +1090,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
char *thiskw = kwlist[i];
if (thiskw == NULL)
break;
- if (PyMapping_HasKeyString(keywords, thiskw)) {
+ if (PyDict_GetItemString(keywords, thiskw)) {
PyErr_Format(PyExc_TypeError,
"keyword parameter '%s' was given "
"by position and by name",
@@ -1105,9 +1105,8 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
len = nargs;
if (keywords && nargs < min) {
for (i = nargs; i < min; i++) {
- if (PyMapping_HasKeyString(keywords, kwlist[i])) {
+ if (PyDict_GetItemString(keywords, kwlist[i]))
len++;
- }
}
}
PyErr_Clear();
@@ -1168,15 +1167,16 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
PyObject *item;
if (*format == '|')
format++;
- item = PyMapping_GetItemString(keywords, kwlist[i]);
+ item = PyDict_GetItemString(keywords, kwlist[i]);
if (item != NULL) {
+ Py_INCREF(item);
msg = convertitem(item, &format, p_va, levels, msgbuf);
+ Py_DECREF(item);
if (msg) {
seterror(i+1, msg, levels, fname, message);
return 0;
}
converted++;
- Py_DECREF(item);
}
else {
PyErr_Clear();