New submission from Isaiah Peng <[email protected]>: The `col_offset` of the ast.Tuple node is set to the column offset of the first element, shown in code:
>>> a = "{1,2,3}"
>>> b = ast.parse(a).body[0]
>>>
>>>
>>> b.value.col_offset
0
>>> a = "[1,2,3]"
>>>
>>>
>>> b = ast.parse(a).body[0]
>>>
>>>
>>> b.value.col_offset
>>>
>>>
0
>>> a = "(1,2,3)"
>>>
>>>
>>> ast.parse(a).body[0].value.col_offset
>>>
>>>
1
>>> a = "()"
>>>
>>>
>>> ast.parse(a).body[0].value.col_offset
>>>
>>>
0
It's correct for dict, set, list, even empty tuple, Though this is not a
serious bug, for other python implementations that uses the tests as language
spec, this is annoying.
----------
components: Library (Lib)
messages: 316665
nosy: isaiah
priority: normal
severity: normal
status: open
title: ast.Tuple has wrong col_offset
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
