In the description of PEP 498, there is an example of a format specifier that itself contains interpolated values:
https://www.python.org/dev/peps/pep-0498/#format-specifiers
>>> width = 10
>>> precision = 4
>>> value = decimal.Decimal('12.34567')
>>> f'result: {value:{width}.{precision}}'
The unparse method doesn't seem to handle this well:
>>> astunparse.unparse(ast.parse("f'result: {value:{width}.{precision}}'"))
"\nf'''result: {value:f'''{width}.{precision}'''}'''\n"
Notice that the part after value: is not bare but rather inside a format string, which isn't valid. The correct behavior should be:
>>> astunparse.unparse(ast.parse("f'result: {value:{width}.{precision}}'"))
"\nf'''result: {value:{width}.{precision}}'''\n"
In the description of PEP 498, there is an example of a format specifier that itself contains interpolated values:
https://www.python.org/dev/peps/pep-0498/#format-specifiers
The unparse method doesn't seem to handle this well:
Notice that the part after
value:is not bare but rather inside a format string, which isn't valid. The correct behavior should be: