[issue29051] Improve error reporting involving f-strings (PEP 498)

Claudiu Popa report at bugs.python.org
Sun Mar 12 10:03:38 EDT 2017


Claudiu Popa added the comment:

I'm adding another example here, where the lineno reporting is wrong:

  from ast import parse 
  n = parse('''

  def test():
     return f"{a}"
  ''')
  f = n.body[0].body[0].value.values[0]
  n = f.value
  print("name lineno", n.lineno)

In this example, the line number of the f-string inner variable is 1, while it should be 3.
As Mark Shannon said, this bug is affecting tools such as pyflakes and pylint.

----------
nosy: +Claudiu.Popa

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29051>
_______________________________________


More information about the Python-bugs-list mailing list