mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
vgetargskeywords: Now that it's clear that nkwlist must equal max, and
we're ensuring that's true during the format parse, get rid of nkwlist.
This commit is contained in:
parent
dc5eff9170
commit
b639d49798
1 changed files with 3 additions and 4 deletions
|
@ -1032,7 +1032,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
char *fname, *message;
|
char *fname, *message;
|
||||||
int min, max;
|
int min, max;
|
||||||
char *formatsave;
|
char *formatsave;
|
||||||
int i, len, nargs, nkeywords, nkwlist;
|
int i, len, nargs, nkeywords;
|
||||||
char *msg, *ks, **p;
|
char *msg, *ks, **p;
|
||||||
int pos, match, converted;
|
int pos, match, converted;
|
||||||
PyObject *key, *value;
|
PyObject *key, *value;
|
||||||
|
@ -1093,7 +1093,6 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
min = max;
|
min = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
nkwlist = max;
|
|
||||||
nargs = PyTuple_GET_SIZE(args);
|
nargs = PyTuple_GET_SIZE(args);
|
||||||
nkeywords = keywords == NULL ? 0 : PyDict_Size(keywords);
|
nkeywords = keywords == NULL ? 0 : PyDict_Size(keywords);
|
||||||
|
|
||||||
|
@ -1170,7 +1169,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
/* convert the keyword arguments; this uses the format
|
/* convert the keyword arguments; this uses the format
|
||||||
string where it was left after processing args */
|
string where it was left after processing args */
|
||||||
converted = 0;
|
converted = 0;
|
||||||
for (i = nargs; i < nkwlist; i++) {
|
for (i = nargs; i < max; i++) {
|
||||||
PyObject *item;
|
PyObject *item;
|
||||||
if (*format == '|')
|
if (*format == '|')
|
||||||
format++;
|
format++;
|
||||||
|
@ -1202,7 +1201,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
while (PyDict_Next(keywords, &pos, &key, &value)) {
|
while (PyDict_Next(keywords, &pos, &key, &value)) {
|
||||||
match = 0;
|
match = 0;
|
||||||
ks = PyString_AsString(key);
|
ks = PyString_AsString(key);
|
||||||
for (i = 0; i < nkwlist; i++) {
|
for (i = 0; i < max; i++) {
|
||||||
if (!strcmp(ks, kwlist[i])) {
|
if (!strcmp(ks, kwlist[i])) {
|
||||||
match = 1;
|
match = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue