@@ -275,7 +275,8 @@ static inline void shift_arg(expr_ty parent, arg_ty n, int line, int col) {
275
275
}
276
276
277
277
static 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 ++ ) {
279
280
expr_ty expr = asdl_seq_GET (seq , i );
280
281
if (expr == NULL ){
281
282
continue ;
@@ -322,12 +323,13 @@ static void fstring_shift_argument(expr_ty parent, arg_ty arg, int lineno, int c
322
323
}
323
324
324
325
static 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 ++ ) {
326
328
arg_ty arg = asdl_seq_GET (args -> posonlyargs , i );
327
329
shift_arg (parent , arg , lineno , col_offset );
328
330
}
329
331
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 ++ ) {
331
333
arg_ty arg = asdl_seq_GET (args -> args , i );
332
334
shift_arg (parent , arg , lineno , col_offset );
333
335
}
@@ -336,7 +338,7 @@ static void fstring_shift_arguments(expr_ty parent, arguments_ty args, int linen
336
338
shift_arg (parent , args -> vararg , lineno , col_offset );
337
339
}
338
340
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 ++ ) {
340
342
arg_ty arg = asdl_seq_GET (args -> kwonlyargs , i );
341
343
shift_arg (parent , arg , lineno , col_offset );
342
344
}
@@ -351,6 +353,7 @@ static void fstring_shift_arguments(expr_ty parent, arguments_ty args, int linen
351
353
}
352
354
353
355
static void fstring_shift_children_locations (expr_ty n , int lineno , int col_offset ) {
356
+ Py_ssize_t i ;
354
357
switch (n -> kind ) {
355
358
case BoolOp_kind :
356
359
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
384
387
break ;
385
388
case ListComp_kind :
386
389
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 ++ ) {
388
391
comprehension_ty comp = asdl_seq_GET (n -> v .ListComp .generators , i );
389
392
fstring_shift_comprehension (n , comp , lineno , col_offset );
390
393
}
391
394
break ;
392
395
case SetComp_kind :
393
396
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 ++ ) {
395
398
comprehension_ty comp = asdl_seq_GET (n -> v .SetComp .generators , i );
396
399
fstring_shift_comprehension (n , comp , lineno , col_offset );
397
400
}
398
401
break ;
399
402
case DictComp_kind :
400
403
shift_expr (n , n -> v .DictComp .key , lineno , col_offset );
401
404
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 ++ ) {
403
406
comprehension_ty comp = asdl_seq_GET (n -> v .DictComp .generators , i );
404
407
fstring_shift_comprehension (n , comp , lineno , col_offset );
405
408
}
406
409
break ;
407
410
case GeneratorExp_kind :
408
411
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 ++ ) {
410
413
comprehension_ty comp = asdl_seq_GET (n -> v .GeneratorExp .generators , i );
411
414
fstring_shift_comprehension (n , comp , lineno , col_offset );
412
415
}
@@ -427,7 +430,7 @@ static void fstring_shift_children_locations(expr_ty n, int lineno, int col_offs
427
430
case Call_kind :
428
431
shift_expr (n , n -> v .Call .func , lineno , col_offset );
429
432
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 ++ ) {
431
434
keyword_ty keyword = asdl_seq_GET (n -> v .Call .keywords , i );
432
435
shift_expr (n , keyword -> value , lineno , col_offset );
433
436
}
@@ -518,7 +521,8 @@ fstring_fix_expr_location(Token *parent, expr_ty n, char *expr_str)
518
521
}
519
522
/* adjust the start based on the number of newlines encountered
520
523
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 ++ ) {
522
526
if (* p == '\n' ) {
523
527
lines ++ ;
524
528
}
0 commit comments