@@ -1028,13 +1028,13 @@ forbidden_name(struct compiling *c, identifier name, const node *n,
1028
1028
}
1029
1029
1030
1030
static expr_ty
1031
- copy_location (expr_ty e , const node * n )
1031
+ copy_location (expr_ty e , const node * n , const node * end )
1032
1032
{
1033
1033
if (e ) {
1034
1034
e -> lineno = LINENO (n );
1035
1035
e -> col_offset = n -> n_col_offset ;
1036
- e -> end_lineno = n -> n_end_lineno ;
1037
- e -> end_col_offset = n -> n_end_col_offset ;
1036
+ e -> end_lineno = end -> n_end_lineno ;
1037
+ e -> end_col_offset = end -> n_end_col_offset ;
1038
1038
}
1039
1039
return e ;
1040
1040
}
@@ -2464,10 +2464,10 @@ ast_for_atom(struct compiling *c, const node *n)
2464
2464
}
2465
2465
2466
2466
if (TYPE (CHILD (ch , 1 )) == comp_for ) {
2467
- return copy_location (ast_for_genexp (c , ch ), n );
2467
+ return copy_location (ast_for_genexp (c , ch ), n , n );
2468
2468
}
2469
2469
else {
2470
- return copy_location (ast_for_testlist (c , ch ), n );
2470
+ return copy_location (ast_for_testlist (c , ch ), n , n );
2471
2471
}
2472
2472
case LSQB : /* list (or list comprehension) */
2473
2473
ch = CHILD (n , 1 );
@@ -2486,7 +2486,7 @@ ast_for_atom(struct compiling *c, const node *n)
2486
2486
n -> n_end_lineno , n -> n_end_col_offset , c -> c_arena );
2487
2487
}
2488
2488
else {
2489
- return copy_location (ast_for_listcomp (c , ch ), n );
2489
+ return copy_location (ast_for_listcomp (c , ch ), n , n );
2490
2490
}
2491
2491
case LBRACE : {
2492
2492
/* dictorsetmaker: ( ((test ':' test | '**' test)
@@ -2527,7 +2527,7 @@ ast_for_atom(struct compiling *c, const node *n)
2527
2527
/* It's a dictionary display. */
2528
2528
res = ast_for_dictdisplay (c , ch );
2529
2529
}
2530
- return copy_location (res , n );
2530
+ return copy_location (res , n , n );
2531
2531
}
2532
2532
}
2533
2533
default :
@@ -3146,7 +3146,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func,
3146
3146
}
3147
3147
else if (TYPE (CHILD (ch , 1 )) == comp_for ) {
3148
3148
/* the lone generator expression */
3149
- e = copy_location (ast_for_genexp (c , ch ), maybegenbeg );
3149
+ e = copy_location (ast_for_genexp (c , ch ), maybegenbeg , closepar );
3150
3150
if (!e )
3151
3151
return NULL ;
3152
3152
asdl_seq_SET (args , nargs ++ , e );
0 commit comments