mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-40334: Fix shifting of nested f-strings in the new parser (GH-19771)
`JoinedStr`s and `FormattedValue also needs to be shifted, in order to correctly compute the location information of nested f-strings.
This commit is contained in:
parent
ae00a5a885
commit
37af21b667
2 changed files with 10 additions and 2 deletions
|
@ -207,8 +207,7 @@ f'{a * f"-{x()}-"}'"""
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue