An unclosed f-string replacement field can report an error on a later line, making the opening brace hard to find:
var = "abc"
a = f""" {var} extern "C" { """
b = """ string """
File "script.py", line 3
b = """ string """
^
SyntaxError: f-string: expecting '}'
The quotes after the second { start a string inside the replacement field. That string ends on line 3, and the final quotes start another string that is never closed.
The error should include the line number of the opening brace:
SyntaxError: f-string: expecting '}' to close '{' on line 2
The same problem affects t-strings. Valid strings inside replacement fields should continue to work.
Linked PRs
An unclosed f-string replacement field can report an error on a later line, making the opening brace hard to find:
The quotes after the second
{start a string inside the replacement field. That string ends on line 3, and the final quotes start another string that is never closed.The error should include the line number of the opening brace:
The same problem affects t-strings. Valid strings inside replacement fields should continue to work.
Linked PRs