Fixes loop variables to be the same types as their limit (GH-120958)

This commit is contained in:
Steve Dower 2024-06-24 17:11:47 +01:00 committed by GitHub
parent 2e157851e3
commit e731554337
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 26 additions and 26 deletions

View file

@ -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); \