[issue40141] Add line and column information for keywords in the AST

2020-04-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 40cf35c5b070b3f33aae58a996fea0e8291a8616 by Pablo Galindo in 
branch 'master':
bpo-40141: Include the value in the column position for keyword AST nodes 
(GH-19348)
https://github.com/python/cpython/commit/40cf35c5b070b3f33aae58a996fea0e8291a8616


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +18711
pull_request: https://github.com/python/cpython/pull/19348

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 168660b547d5f683c5d3c60447cfa8c6d620efc3 by Pablo Galindo in 
branch 'master':
bpo-40141: Add line and column information to ast.keyword nodes (GH-19283)
https://github.com/python/cpython/commit/168660b547d5f683c5d3c60447cfa8c6d620efc3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am preparing more PRs for other nodes that are missing the meta-information 
as well but will open them in a separate issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +18640
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19283

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

When inspecting keyword parameters in a function call, the keyword is stored as 
a string and not as a AST node:

>>> import ast
>>> r = "f(a,   xxa  =  34, y=23)"
>>> node = ast.parse(r)
>>> ll = node.body[0].value.keywords[0].arg
>>> node.body[0].value.keywords[0].arg
'xxa'

this makes impossible to locate the keyword in the code using the AST as it 
lacks AST attributes (lineno, col_offset, end_lineno, end_col_offset).

On the other hand, this does not happen with args, that has the 
meta-information:

>>> node.body[0].value.args[0].id
'a'
>>> dir(node.body[0].value.args[0])


So one can locate the arg string using:

>>> r[arg.col_offset:arg.end_col_offset]
'a'

For this reason, we should add the same information to keyword nodes.

--
components: Interpreter Core
messages: 365509
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Add line and column information for keywords in the AST
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com