[Python-checkins] CVS: python/dist/src/Python getargs.c,2.75,2.76
Tim Peters
tim_one@users.sourceforge.net
Fri, 26 Oct 2001 21:45:36 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv6119/python/Python
Modified Files:
getargs.c
Log Message:
vgetargskeywords:
+ Got rid of now-redundant dict typecheck.
+ Renamed nkwds to nkwlist. Now all the "counting" vrbls have names
related to the things they're counting in an obvious way.
Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.75
retrieving revision 2.76
diff -C2 -d -r2.75 -r2.76
*** getargs.c 2001/10/27 04:38:11 2.75
--- getargs.c 2001/10/27 04:45:34 2.76
***************
*** 1035,1039 ****
int i, len, nargs, nkeywords;
char *msg, *ks, **p;
! int nkwds, pos, match, converted;
PyObject *key, *value;
--- 1035,1039 ----
int i, len, nargs, nkeywords;
char *msg, *ks, **p;
! int nkwlist, pos, match, converted;
PyObject *key, *value;
***************
*** 1081,1102 ****
nargs = PyTuple_GET_SIZE(args);
- /* do a cursory check of the keywords just to see how many we got */
-
- nkeywords = 0;
- if (keywords) {
- if (!PyDict_Check(keywords)) {
- PyErr_Format(PyExc_SystemError,
- "%s received when keyword dictionary expected",
- keywords->ob_type->tp_name);
- return 0;
- }
- nkeywords = PyDict_Size(keywords);
- }
-
/* make sure there are no duplicate values for an argument;
its not clear when to use the term "keyword argument vs.
keyword parameter in messages */
-
if (keywords) {
for (i = 0; i < nargs; i++) {
--- 1081,1089 ----
nargs = PyTuple_GET_SIZE(args);
+ nkeywords = keywords == NULL ? 0 : PyDict_Size(keywords);
/* make sure there are no duplicate values for an argument;
its not clear when to use the term "keyword argument vs.
keyword parameter in messages */
if (keywords) {
for (i = 0; i < nargs; i++) {
***************
*** 1176,1187 ****
number of items in the format string */
! nkwds = 0;
p = kwlist;
for (;;) {
if (!*(p++)) break;
! nkwds++;
}
! if (nkwds != max) {
PyErr_SetString(PyExc_SystemError,
"number of items in format string and keyword list do not match");
--- 1163,1174 ----
number of items in the format string */
! nkwlist = 0;
p = kwlist;
for (;;) {
if (!*(p++)) break;
! nkwlist++;
}
! if (nkwlist != max) {
PyErr_SetString(PyExc_SystemError,
"number of items in format string and keyword list do not match");
***************
*** 1193,1197 ****
converted = 0;
! for (i = nargs; i < nkwds; i++) {
PyObject *item;
if (*format == '|')
--- 1180,1184 ----
converted = 0;
! for (i = nargs; i < nkwlist; i++) {
PyObject *item;
if (*format == '|')
***************
*** 1224,1228 ****
match = 0;
ks = PyString_AsString(key);
! for (i = 0; i < nkwds; i++) {
if (!strcmp(ks, kwlist[i])) {
match = 1;
--- 1211,1215 ----
match = 0;
ks = PyString_AsString(key);
! for (i = 0; i < nkwlist; i++) {
if (!strcmp(ks, kwlist[i])) {
match = 1;