[New-bugs-announce] [issue39474] col_offset for parenthesized expressions looks weird on attribute access

Batuhan report at bugs.python.org
Tue Jan 28 03:41:48 EST 2020


New submission from Batuhan <batuhanosmantaskaya at gmail.com>:

Python 3.9.0a2+ (heads/master:65ecc390c1, Jan 26 2020, 15:39:11) 
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> source = "(2+2).source"
>>> ast.get_source_segment(source, ast.parse(source).body[0].value)
'2+2).source'
>>> source = "(2+2)[1]"
>>> ast.get_source_segment(source, ast.parse(source).body[0].value)
'2+2)[1]'

I can prepare a patch to extend attribute's col_offset into parens if it is any if approved.

----------
components: Interpreter Core
messages: 360844
nosy: BTaskaya, benjamin.peterson, pablogsal
priority: normal
severity: normal
status: open
title: col_offset for parenthesized expressions looks weird on attribute access
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39474>
_______________________________________


More information about the New-bugs-announce mailing list