[issue43798] Add position metadata to alias AST type

2021-04-14 Thread Florian Bruhin


Change by Florian Bruhin :


--
nosy: +The Compiler

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ah, it was not clear from the issue that pytest was constructing nodes by hand. 
It makes sense now. Thanks!

--

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-12 Thread daniel hahler


Change by daniel hahler :


--
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



[issue43798] Add position metadata to alias AST type

2021-04-12 Thread daniel hahler


daniel hahler  added the comment:

@Pablo: the problem (referenced in the pytest issue) is that `ast.alias` has 
new required arguments now (see also the adjusted test in
https://github.com/python/cpython/commit/75a06f067bd0a2687312e5f8e78f9075be76ad3a#diff-3f516b60719dd445d33225e4f316b36e85c9c51a843a0147349d11a005c55937R1060-R1061).
  That's expected/wanted though (assuming that it should not have "defaults" 
for B/C), and there's a patch for the issue at 
https://github.com/pytest-dev/pytest/pull/8540.

--
nosy: +blueyed

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> FYI, probably unavoidable, but this appears to have broken pytest 
> https://github.com/pytest-dev/pytest/issues/8539

What's the problem? alias objects *have* lineno argument:

>>> print(ast.dump(ast.parse("from x import y"), include_attributes=True, 
>>> indent=4))
Module(
body=[
ImportFrom(
module='x',
names=[
alias(
name='y',
lineno=1,
col_offset=14,
end_lineno=1,
end_col_offset=15)],
level=0,
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=15)],
type_ignores=[])

--

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-11 Thread Shantanu


Shantanu  added the comment:

FYI, probably unavoidable, but this appears to have broken pytest 
https://github.com/pytest-dev/pytest/issues/8539

--
nosy: +hauntsaninja

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-10 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
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



[issue43798] Add position metadata to alias AST type

2021-04-10 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:


New changeset 75a06f067bd0a2687312e5f8e78f9075be76ad3a by Matthew Suozzo in 
branch 'master':
bpo-43798: Add source location attributes to alias (GH-25324)
https://github.com/python/cpython/commit/75a06f067bd0a2687312e5f8e78f9075be76ad3a


--

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Ah and one other question: Is this normally the sort of thing that would get 
> backported? It should be very straightforward to do so, at least for 3.9 
> given the support for the new parser.

Unfortunately no, is technically a new feature.

--

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

I'm okay with this, unless someone has any input on why the alias node should 
not have line/column info (and did not have it in the first place).

--
nosy: +BTaskaya, gvanrossum, lys.nikolaou, pablogsal

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Matthew Suozzo


Matthew Suozzo  added the comment:

Ah and one other question: Is this normally the sort of thing that would get 
backported? It should be very straightforward to do so, at least for 3.9 given 
the support for the new parser.

--
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Matthew Suozzo


Change by Matthew Suozzo :


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

___
Python tracker 

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



[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Matthew Suozzo


New submission from Matthew Suozzo :

Given the increasing use of long `from typing import foo, bar, ...` import 
sequences, it's becoming more desirable to address individual components of the 
import node. Unfortunately, the ast.alias node doesn't contain source location 
metadata (e.g. lineno, col_offset).

This metadata would be comparatively easy to add, backwards compatible, and 
would enable more precise diagnostics e.g. lints.

--
components: Interpreter Core
messages: 390663
nosy: matthew.suozzo
priority: normal
severity: normal
status: open
title: Add position metadata to alias AST type
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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