diff options
author | Steve Dower <steve.dower@python.org> | 2024-06-24 16:11:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 16:11:47 (GMT) |
commit | e7315543377322e4c6e0d8d2c4a4bb4626e43f4c (patch) | |
tree | 956e3eb3c667a53aa60954e36916d165f2333bab /Python/ast_opt.c | |
parent | 2e157851e36d83b0cb079b161d633b16ab899d16 (diff) | |
download | cpython-e7315543377322e4c6e0d8d2c4a4bb4626e43f4c.zip cpython-e7315543377322e4c6e0d8d2c4a4bb4626e43f4c.tar.gz cpython-e7315543377322e4c6e0d8d2c4a4bb4626e43f4c.tar.bz2 |
Fixes loop variables to be the same types as their limit (GH-120958)
Diffstat (limited to 'Python/ast_opt.c')
-rw-r--r-- | Python/ast_opt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 6d1bfaf..2e2c78b 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -521,7 +521,7 @@ fold_binop(expr_ty node, PyArena *arena, _PyASTOptimizeState *state) static PyObject* make_const_tuple(asdl_expr_seq *elts) { - for (int i = 0; i < asdl_seq_LEN(elts); i++) { + for (Py_ssize_t i = 0; i < asdl_seq_LEN(elts); i++) { expr_ty e = (expr_ty)asdl_seq_GET(elts, i); if (e->kind != Constant_kind) { return NULL; @@ -533,7 +533,7 @@ make_const_tuple(asdl_expr_seq *elts) return NULL; } - for (int i = 0; i < asdl_seq_LEN(elts); i++) { + for (Py_ssize_t i = 0; i < asdl_seq_LEN(elts); i++) { expr_ty e = (expr_ty)asdl_seq_GET(elts, i); PyObject *v = e->v.Constant.value; PyTuple_SET_ITEM(newval, i, Py_NewRef(v)); @@ -650,7 +650,7 @@ static int astfold_type_param(type_param_ty node_, PyArena *ctx_, _PyASTOptimize return 0; #define CALL_SEQ(FUNC, TYPE, ARG) { \ - int i; \ + Py_ssize_t i; \ asdl_ ## TYPE ## _seq *seq = (ARG); /* avoid variable capture */ \ for (i = 0; i < asdl_seq_LEN(seq); i++) { \ TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \ |