Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ def test_ast_line_numbers_nested(self):
call = binop.right.values[1].value
self.assertEqual(type(call), ast.Call)
self.assertEqual(call.lineno, 3)
if support.use_old_parser():
self.assertEqual(call.col_offset, 11)
self.assertEqual(call.col_offset, 11)

def test_ast_line_numbers_duplicate_expression(self):
"""Duplicate expression
Expand Down
9 changes: 9 additions & 0 deletions Parser/pegen/parse_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@ static void fstring_shift_children_locations(expr_ty n, int lineno, int col_offs
case Tuple_kind:
fstring_shift_seq_locations(n, n->v.Tuple.elts, lineno, col_offset);
break;
case JoinedStr_kind:
fstring_shift_seq_locations(n, n->v.JoinedStr.values, lineno, col_offset);
break;
case FormattedValue_kind:
shift_expr(n, n->v.FormattedValue.value, lineno, col_offset);
if (n->v.FormattedValue.format_spec) {
shift_expr(n, n->v.FormattedValue.format_spec, lineno, col_offset);
}
break;
default:
return;
}
Expand Down