Skip to content

Commit

Permalink
bpo-40147: Fix a compiler warning on Windows in Python/compile.c (GH-…
Browse files Browse the repository at this point in the history
…19389)

Change the type of nkeywords to Py_ssize_t.
  • Loading branch information
ZackerySpytz authored Apr 6, 2020
1 parent c63629e commit 08050e9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -4050,14 +4050,15 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
}

static int
validate_keywords(struct compiler *c, asdl_seq* keywords) {
int nkeywords = asdl_seq_LEN(keywords);
for (int i = 0; i < nkeywords; i++) {
validate_keywords(struct compiler *c, asdl_seq *keywords)
{
Py_ssize_t nkeywords = asdl_seq_LEN(keywords);
for (Py_ssize_t i = 0; i < nkeywords; i++) {
keyword_ty key = ((keyword_ty)asdl_seq_GET(keywords, i));
if (key->arg == NULL) {
continue;
}
for (int j = i+1; j < nkeywords; j++) {
for (Py_ssize_t j = i + 1; j < nkeywords; j++) {
keyword_ty other = ((keyword_ty)asdl_seq_GET(keywords, j));
if (other->arg && !PyUnicode_Compare(key->arg, other->arg)) {
PyObject *msg = PyUnicode_FromFormat("keyword argument repeated: %U", key->arg);
Expand Down

0 comments on commit 08050e9

Please sign in to comment.