[issue37458] ast: Different FormattedValue expressions have same col_offset information

2020-07-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think waiting until we decide what to do with the parser makes sense. This 
problem has been around for a while, and while it's unfortunate I don't think 
it's worth heroic measures to fix.

--

___
Python tracker 

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



[issue37458] ast: Different FormattedValue expressions have same col_offset information

2020-07-04 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



[issue37458] ast: Different FormattedValue expressions have same col_offset information

2020-07-04 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

> I still see this problem with 3.10, which I thought might have fixed this.
Nope, that's still true in 3.10.

>I'm working on overhauling how these are calculated. But it's complex, and is 
>taking a while.
In short, the FormattedValue nodes all have the exact same lineno's and 
col_offset's, which are also identical to those of the enclosing JoinedStr 
node. These values are equal to lineno and col_offset of the first STRING token 
and end_lineno and end_col_offset of the last STRING token (note that the 
grammar accepts a STRING+ node).

> any ideas on this?
Moving f-string parsing to the parser, which we've been talking about lately, 
would solve this. But this will probably take some time, since I currently do 
not have the time. It's probably going to be a good project for this coming 
fall.

Another alternative, in case we don't want to wait until then, would be for the 
handwritten f-string parser to have its own instances of a lineno and 
col_offset, so that they can be used when the FormattedValue nodes are created. 
This would probably also require some effort though, so I'm not sure we want to 
do it, before we really know if we're gonnna proceed with the "moving f-string 
parsing to PEG" project.

--

___
Python tracker 

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



[issue37458] ast: Different FormattedValue expressions have same col_offset information

2020-07-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

I still see this problem with 3.10, which I thought might have fixed this.

@lys.nikolaou: any ideas on this?

--
components: +Interpreter Core -Library (Lib)
nosy: +lys.nikolaou
versions: +Python 3.10 -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



[issue37458] ast: Different FormattedValue expressions have same col_offset information

2019-07-01 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm working on overhauling how these are calculated. But it's complex, and is 
taking a while.

--
assignee:  -> eric.smith
nosy: +eric.smith

___
Python tracker 

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



[issue37458] ast: Different FormattedValue expressions have same col_offset information

2019-06-30 Thread Weijar Z


New submission from Weijar Z :

This express 

  f"{x}{x}{y}"

will produce ast tree:

{
"$node": "Module",
"body": [
{
"$node": "Expr",
"value": {
"$node": "JoinedStr",
"values": [
{
"$node": "FormattedValue",
"value": {
"$node": "Name",
"id": "x",
"ctx": {
"$node": "Load"
},
"lineno": 1,
"col_offset": 3
},
"conversion": -1,
"format_spec": null,
"lineno": 1,
"col_offset": 0
},
{
"$node": "FormattedValue",
"value": {
"$node": "Name",
"id": "x",
"ctx": {
"$node": "Load"
},
"lineno": 1,
"col_offset": 3
},
"conversion": -1,
"format_spec": null,
"lineno": 1,
"col_offset": 0
},
{
"$node": "FormattedValue",
"value": {
"$node": "Name",
"id": "y",
"ctx": {
"$node": "Load"
},
"lineno": 1,
"col_offset": 9
},
"conversion": -1,
"format_spec": null,
"lineno": 1,
"col_offset": 0
}
],
"lineno": 1,
"col_offset": 0
},
"lineno": 1,
"col_offset": 0
}
]
}

These two variable 'x' has same col_offset '3', is it wrong?

--
components: Library (Lib)
messages: 346950
nosy: Weijar Z
priority: normal
severity: normal
status: open
title: ast: Different FormattedValue expressions have same col_offset 
information
type: behavior
versions: 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