This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lys.nikolaou
Recipients Weijar Z, eric.smith, lys.nikolaou
Date 2020-07-04.13:24:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593869067.23.0.853130329616.issue37458@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2020-07-04 13:24:27lys.nikolaousetrecipients: + lys.nikolaou, eric.smith, Weijar Z
2020-07-04 13:24:27lys.nikolaousetmessageid: <1593869067.23.0.853130329616.issue37458@roundup.psfhosted.org>
2020-07-04 13:24:27lys.nikolaoulinkissue37458 messages
2020-07-04 13:24:26lys.nikolaoucreate