@@ -275,7 +275,8 @@ static inline void shift_arg(expr_ty parent, arg_ty n, int line, int col) {
275275}
276276
277277static void fstring_shift_seq_locations (expr_ty parent , asdl_seq * seq , int lineno , int col_offset ) {
278- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (seq ); i < l ; i ++ ) {
278+ Py_ssize_t i ;
279+ for (i = 0 ; i < asdl_seq_LEN (seq ); i ++ ) {
279280 expr_ty expr = asdl_seq_GET (seq , i );
280281 if (expr == NULL ){
281282 continue ;
@@ -322,12 +323,13 @@ static void fstring_shift_argument(expr_ty parent, arg_ty arg, int lineno, int c
322323}
323324
324325static void fstring_shift_arguments (expr_ty parent , arguments_ty args , int lineno , int col_offset ) {
325- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (args -> posonlyargs ); i < l ; i ++ ) {
326+ Py_ssize_t i ;
327+ for (i = 0 ; i < asdl_seq_LEN (args -> posonlyargs ); i ++ ) {
326328 arg_ty arg = asdl_seq_GET (args -> posonlyargs , i );
327329 shift_arg (parent , arg , lineno , col_offset );
328330 }
329331
330- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (args -> args ); i < l ; i ++ ) {
332+ for (i = 0 ; i < asdl_seq_LEN (args -> args ); i ++ ) {
331333 arg_ty arg = asdl_seq_GET (args -> args , i );
332334 shift_arg (parent , arg , lineno , col_offset );
333335 }
@@ -336,7 +338,7 @@ static void fstring_shift_arguments(expr_ty parent, arguments_ty args, int linen
336338 shift_arg (parent , args -> vararg , lineno , col_offset );
337339 }
338340
339- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (args -> kwonlyargs ); i < l ; i ++ ) {
341+ for (i = 0 ; i < asdl_seq_LEN (args -> kwonlyargs ); i ++ ) {
340342 arg_ty arg = asdl_seq_GET (args -> kwonlyargs , i );
341343 shift_arg (parent , arg , lineno , col_offset );
342344 }
@@ -351,6 +353,7 @@ static void fstring_shift_arguments(expr_ty parent, arguments_ty args, int linen
351353}
352354
353355static void fstring_shift_children_locations (expr_ty n , int lineno , int col_offset ) {
356+ Py_ssize_t i ;
354357 switch (n -> kind ) {
355358 case BoolOp_kind :
356359 fstring_shift_seq_locations (n , n -> v .BoolOp .values , lineno , col_offset );
@@ -384,29 +387,29 @@ static void fstring_shift_children_locations(expr_ty n, int lineno, int col_offs
384387 break ;
385388 case ListComp_kind :
386389 shift_expr (n , n -> v .ListComp .elt , lineno , col_offset );
387- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (n -> v .ListComp .generators ); i < l ; i ++ ) {
390+ for (i = 0 ; i < asdl_seq_LEN (n -> v .ListComp .generators ); i ++ ) {
388391 comprehension_ty comp = asdl_seq_GET (n -> v .ListComp .generators , i );
389392 fstring_shift_comprehension (n , comp , lineno , col_offset );
390393 }
391394 break ;
392395 case SetComp_kind :
393396 shift_expr (n , n -> v .SetComp .elt , lineno , col_offset );
394- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (n -> v .SetComp .generators ); i < l ; i ++ ) {
397+ for (i = 0 ; i < asdl_seq_LEN (n -> v .SetComp .generators ); i ++ ) {
395398 comprehension_ty comp = asdl_seq_GET (n -> v .SetComp .generators , i );
396399 fstring_shift_comprehension (n , comp , lineno , col_offset );
397400 }
398401 break ;
399402 case DictComp_kind :
400403 shift_expr (n , n -> v .DictComp .key , lineno , col_offset );
401404 shift_expr (n , n -> v .DictComp .value , lineno , col_offset );
402- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (n -> v .DictComp .generators ); i < l ; i ++ ) {
405+ for (i = 0 ; i < asdl_seq_LEN (n -> v .DictComp .generators ); i ++ ) {
403406 comprehension_ty comp = asdl_seq_GET (n -> v .DictComp .generators , i );
404407 fstring_shift_comprehension (n , comp , lineno , col_offset );
405408 }
406409 break ;
407410 case GeneratorExp_kind :
408411 shift_expr (n , n -> v .GeneratorExp .elt , lineno , col_offset );
409- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (n -> v .GeneratorExp .generators ); i < l ; i ++ ) {
412+ for (i = 0 ; i < asdl_seq_LEN (n -> v .GeneratorExp .generators ); i ++ ) {
410413 comprehension_ty comp = asdl_seq_GET (n -> v .GeneratorExp .generators , i );
411414 fstring_shift_comprehension (n , comp , lineno , col_offset );
412415 }
@@ -427,7 +430,7 @@ static void fstring_shift_children_locations(expr_ty n, int lineno, int col_offs
427430 case Call_kind :
428431 shift_expr (n , n -> v .Call .func , lineno , col_offset );
429432 fstring_shift_seq_locations (n , n -> v .Call .args , lineno , col_offset );
430- for (Py_ssize_t i = 0 , l = asdl_seq_LEN (n -> v .Call .keywords ); i < l ; i ++ ) {
433+ for (i = 0 ; i < asdl_seq_LEN (n -> v .Call .keywords ); i ++ ) {
431434 keyword_ty keyword = asdl_seq_GET (n -> v .Call .keywords , i );
432435 shift_expr (n , keyword -> value , lineno , col_offset );
433436 }
@@ -518,7 +521,8 @@ fstring_fix_expr_location(Token *parent, expr_ty n, char *expr_str)
518521 }
519522 /* adjust the start based on the number of newlines encountered
520523 before the f-string expression */
521- for (char * p = parent_str ; p < substr ; p ++ ) {
524+ char * p ;
525+ for (p = parent_str ; p < substr ; p ++ ) {
522526 if (* p == '\n' ) {
523527 lines ++ ;
524528 }
0 commit comments