diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-10-27 04:38:11 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-10-27 04:38:11 (GMT) |
commit | 6fb2635f257f8288413c6f4fb028e67c12ae8fa1 (patch) | |
tree | 2d80d6fcf38f092c50b6ce72856d67b7d28fb859 /Python | |
parent | 28bf7a97700e4b05ac3062aebc15269f4f72d5b3 (diff) | |
download | cpython-6fb2635f257f8288413c6f4fb028e67c12ae8fa1.zip cpython-6fb2635f257f8288413c6f4fb028e67c12ae8fa1.tar.gz cpython-6fb2635f257f8288413c6f4fb028e67c12ae8fa1.tar.bz2 |
vgetargskeywords:
+ Renamed argslen to nargs.
+ Renamed kwlen to nkeywords. This one was especially confusing because
kwlen wasn't the length of the kwlist argument, but of the keywords
argument.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/getargs.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 0bd41ac..2f876ff 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -1031,8 +1031,8 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, int levels[32]; char *fname, *message; int min, max; - char *formatsave = format; - int i, len, argslen, kwlen; + char *formatsave; + int i, len, nargs, nkeywords; char *msg, *ks, **p; int nkwds, pos, match, converted; PyObject *key, *value; @@ -1051,6 +1051,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, Raise error if a tuple arg spec is found. */ fname = message = NULL; + formatsave = format; min = -1; max = 0; while ((i = *format++) != '\0') { @@ -1078,11 +1079,11 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, } format = formatsave; - argslen = PyTuple_GET_SIZE(args); + nargs = PyTuple_GET_SIZE(args); /* do a cursory check of the keywords just to see how many we got */ - kwlen = 0; + nkeywords = 0; if (keywords) { if (!PyDict_Check(keywords)) { PyErr_Format(PyExc_SystemError, @@ -1090,7 +1091,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, keywords->ob_type->tp_name); return 0; } - kwlen = PyDict_Size(keywords); + nkeywords = PyDict_Size(keywords); } /* make sure there are no duplicate values for an argument; @@ -1098,7 +1099,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, keyword parameter in messages */ if (keywords) { - for (i = 0; i < argslen; i++) { + for (i = 0; i < nargs; i++) { char *thiskw = kwlist[i]; if (thiskw == NULL) break; @@ -1123,9 +1124,9 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, /* required arguments missing from args can be supplied by keyword arguments */ - len = argslen; - if (keywords && argslen < min) { - for (i = argslen; i < min; i++) { + len = nargs; + if (keywords && nargs < min) { + for (i = nargs; i < min; i++) { if (PyMapping_HasKeyString(keywords, kwlist[i])) { len++; } @@ -1155,7 +1156,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, return 0; } - for (i = 0; i < argslen; i++) { + for (i = 0; i < nargs; i++) { if (*format == '|') format++; msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, @@ -1191,7 +1192,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, string where it was left after processing args */ converted = 0; - for (i = argslen; i < nkwds; i++) { + for (i = nargs; i < nkwds; i++) { PyObject *item; if (*format == '|') format++; @@ -1218,7 +1219,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, /* make sure there are no extraneous keyword arguments */ pos = 0; - if (converted < kwlen) { + if (converted < nkeywords) { while (PyDict_Next(keywords, &pos, &key, &value)) { match = 0; ks = PyString_AsString(key); |