[New-bugs-announce] [issue25131] The AST for dict and set displays has the lineno of the first value

Claudiu Popa report at bugs.python.org
Tue Sep 15 20:28:25 CEST 2015


New submission from Claudiu Popa:

Hi,

In Python 3.5, the lineno for dict and set display ASTs is the line number of the first value, not the line number of the display character, as it was until 3.5. Here's an example:


  from ast import parse
  module = parse('''{
           '1':'2',
  }
  ''')
  dict_display = module.body[0].value
  print(dict_display.lineno)

I don't seem to find anything related to this in the documentation, but I presume this is a side effect of the new parser changes. It would nice to have this fixed or at least documented.

----------
components: Library (Lib)
messages: 250790
nosy: Claudiu.Popa
priority: normal
severity: normal
status: open
title: The AST for dict and set displays has the lineno of the first value
type: behavior
versions: Python 3.5, Python 3.6

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


More information about the New-bugs-announce mailing list