Skip to content

Commit 08050e9

Browse files
authored
bpo-40147: Fix a compiler warning on Windows in Python/compile.c (GH-19389)
Change the type of nkeywords to Py_ssize_t.
1 parent c63629e commit 08050e9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Python/compile.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,14 +4050,15 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
40504050
}
40514051

40524052
static int
4053-
validate_keywords(struct compiler *c, asdl_seq* keywords) {
4054-
int nkeywords = asdl_seq_LEN(keywords);
4055-
for (int i = 0; i < nkeywords; i++) {
4053+
validate_keywords(struct compiler *c, asdl_seq *keywords)
4054+
{
4055+
Py_ssize_t nkeywords = asdl_seq_LEN(keywords);
4056+
for (Py_ssize_t i = 0; i < nkeywords; i++) {
40564057
keyword_ty key = ((keyword_ty)asdl_seq_GET(keywords, i));
40574058
if (key->arg == NULL) {
40584059
continue;
40594060
}
4060-
for (int j = i+1; j < nkeywords; j++) {
4061+
for (Py_ssize_t j = i + 1; j < nkeywords; j++) {
40614062
keyword_ty other = ((keyword_ty)asdl_seq_GET(keywords, j));
40624063
if (other->arg && !PyUnicode_Compare(key->arg, other->arg)) {
40634064
PyObject *msg = PyUnicode_FromFormat("keyword argument repeated: %U", key->arg);

0 commit comments

Comments
 (0)