Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f8117f

Browse files
committed
vgetargs1() and vgetargskeywords(): Replace uses of PyTuple_Size() and
PyTuple_GetItem() with PyTuple_GET_SIZE() and PyTuple_GET_ITEM(). The code has already done a PyTuple_Check().
1 parent da20fce commit 0f8117f

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

Python/getargs.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ vgetargs1(PyObject *args, char *format, va_list *p_va, int compat)
112112
}
113113
else if (level != 0)
114114
; /* Pass */
115-
else if (c == 'e')
115+
else if (c == 'e')
116116
; /* Pass */
117117
else if (isalpha(c))
118118
max++;
@@ -166,7 +166,7 @@ vgetargs1(PyObject *args, char *format, va_list *p_va, int compat)
166166
return 0;
167167
}
168168

169-
len = PyTuple_Size(args);
169+
len = PyTuple_GET_SIZE(args);
170170

171171
if (len < min || max < len) {
172172
if (message == NULL) {
@@ -188,8 +188,8 @@ vgetargs1(PyObject *args, char *format, va_list *p_va, int compat)
188188
for (i = 0; i < len; i++) {
189189
if (*format == '|')
190190
format++;
191-
msg = convertitem(PyTuple_GetItem(args, i), &format, p_va,
192-
levels, msgbuf);
191+
msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va,
192+
levels, msgbuf);
193193
if (msg) {
194194
seterror(i+1, msg, levels, fname, message);
195195
return 0;
@@ -1011,12 +1011,10 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
10111011
else if (c == ':') {
10121012
fname = format;
10131013
break;
1014-
}
1015-
else if (c == ';') {
1014+
} else if (c == ';') {
10161015
message = format;
10171016
break;
1018-
}
1019-
else if (c == 'e')
1017+
} else if (c == 'e')
10201018
; /* Pass */
10211019
else if (isalpha(c))
10221020
max++;
@@ -1035,7 +1033,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
10351033
return 0;
10361034
}
10371035

1038-
tplen = PyTuple_Size(args);
1036+
tplen = PyTuple_GET_SIZE(args);
10391037

10401038
/* do a cursory check of the keywords just to see how many we got */
10411039

@@ -1111,7 +1109,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
11111109
for (i = 0; i < tplen; i++) {
11121110
if (*format == '|')
11131111
format++;
1114-
msg = convertitem(PyTuple_GetItem(args, i), &format, p_va,
1112+
msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va,
11151113
levels, msgbuf);
11161114
if (msg) {
11171115
seterror(i+1, msg, levels, fname, message);

0 commit comments

Comments
 (0)