[Python-checkins] CVS: python/dist/src/Python getargs.c,2.78,2.79
Tim Peters
tim_one@users.sourceforge.net
Fri, 26 Oct 2001 22:50:42 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv12868/python/Python
Modified Files:
getargs.c
Log Message:
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.
Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.78
retrieving revision 2.79
diff -C2 -d -r2.78 -r2.79
*** getargs.c 2001/10/27 05:30:17 2.78
--- getargs.c 2001/10/27 05:50:39 2.79
***************
*** 1091,1095 ****
if (thiskw == NULL)
break;
! if (PyMapping_HasKeyString(keywords, thiskw)) {
PyErr_Format(PyExc_TypeError,
"keyword parameter '%s' was given "
--- 1091,1095 ----
if (thiskw == NULL)
break;
! if (PyDict_GetItemString(keywords, thiskw)) {
PyErr_Format(PyExc_TypeError,
"keyword parameter '%s' was given "
***************
*** 1106,1112 ****
if (keywords && nargs < min) {
for (i = nargs; i < min; i++) {
! if (PyMapping_HasKeyString(keywords, kwlist[i])) {
len++;
- }
}
}
--- 1106,1111 ----
if (keywords && nargs < min) {
for (i = nargs; i < min; i++) {
! if (PyDict_GetItemString(keywords, kwlist[i]))
len++;
}
}
***************
*** 1169,1175 ****
if (*format == '|')
format++;
! item = PyMapping_GetItemString(keywords, kwlist[i]);
if (item != NULL) {
msg = convertitem(item, &format, p_va, levels, msgbuf);
if (msg) {
seterror(i+1, msg, levels, fname, message);
--- 1168,1176 ----
if (*format == '|')
format++;
! 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);
***************
*** 1177,1181 ****
}
converted++;
- Py_DECREF(item);
}
else {
--- 1178,1181 ----