Issue 30465: FormattedValue expressions have wrong lineno and col_offset information (original) (raw)

Created on 2017-05-24 22:53 by lukasz.langa, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1800 merged lukasz.langa,2017-05-24 22:57
PR 3409 merged python-dev,2017-09-07 00:28
PR 6593 merged vstinner,2018-04-25 12:48
PR 12920 merged vstinner,2019-04-23 08:09
PR 10021 Anthony Sottile,2020-04-01 23:22
Messages (10)
msg294408 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-05-24 22:53
f-strings are computed in a separate compiler step. This makes their lineno and col_offset information wrong. This is problematic for flake8 which reports problems inside f-strings on the wrong line (typically the first one). Attached patch fixes the issue.
msg294423 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-05-25 01:34
Thanks for adding so many tests.
msg294866 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-31 18:58
I have concerns about following cases. * f-string containing multiple equivalent subexpressions: f'{x} {x}' or f''' {x} {x} ''' * f-string containing escaped newlines: f'''\ \ {x}\ \ ''' The tests look slightly verbose and fragile to me. If once the parser will produce more efficient tree (see ), the tests may fail. Needed more tests (for cases mentioned above), and adding them will add more verbose code. Maybe just find the child (or several children) of specific type and check lineno and col_offset only for it and few its children? If this will make the tests simpler. But if tests can't be made simpler, we should live with this.
msg301368 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2017-09-05 20:37
See also issue 31140: I'm not sure if that case is covered by this issue.
msg301551 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2017-09-07 00:28
New changeset e7c566caf177afe43b57f0b2723e723d880368e8 by ericvsmith (Łukasz Langa) in branch 'master': bpo-30465: Fix lineno and col_offset in fstring AST nodes (#1800) https://github.com/python/cpython/commit/e7c566caf177afe43b57f0b2723e723d880368e8
msg301563 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2017-09-07 02:43
New changeset aa1afc72c1ee1f090e6302198d9a0295f1ce1c05 by ericvsmith (Miss Islington (bot)) in branch '3.6': bpo-30465: Fix lineno and col_offset in fstring AST nodes (GH-1800) (gh-3409) https://github.com/python/cpython/commit/aa1afc72c1ee1f090e6302198d9a0295f1ce1c05
msg303571 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2017-10-02 23:58
Is there more to do on this issue or can it be closed now?
msg303680 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2017-10-04 12:08
I think it's fixed. Closing.
msg315971 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-30 21:51
New changeset fb7e7992beec7f76cc2db77ab6ce1e86446bfccf by Łukasz Langa (Victor Stinner) in branch 'master': bpo-30465: Fix C downcast warning on Windows in ast.c (#6593) https://github.com/python/cpython/commit/fb7e7992beec7f76cc2db77ab6ce1e86446bfccf
msg340699 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-23 08:26
New changeset 8a9a6b443c57e47e9d10ed7775479aada4dac719 by Victor Stinner in branch '3.7': [3.7] bpo-9566: Fix compiler warnings on Windows (GH-12920) https://github.com/python/cpython/commit/8a9a6b443c57e47e9d10ed7775479aada4dac719
History
Date User Action Args
2022-04-11 14:58:46 admin set github: 74650
2020-04-01 23:22:36 Anthony Sottile set nosy: + Anthony Sottilepull_requests: + <pull%5Frequest18644>
2019-04-23 08:26:14 vstinner set nosy: + vstinnermessages: +
2019-04-23 08:09:08 vstinner set pull_requests: + <pull%5Frequest12847>
2018-04-30 21:51:05 lukasz.langa set messages: +
2018-04-25 12:48:04 vstinner set pull_requests: + <pull%5Frequest6291>
2017-10-04 12:08:59 eric.smith set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2017-10-02 23:58:59 ned.deily set nosy: + ned.deilymessages: +
2017-09-07 02:43:06 eric.smith set messages: +
2017-09-07 00:28:08 python-dev set pull_requests: + <pull%5Frequest3410>
2017-09-07 00:28:00 eric.smith set messages: +
2017-09-05 20:37:20 eric.smith set messages: +
2017-06-15 17:14:38 serhiy.storchaka set messages: -
2017-06-15 17:14:26 serhiy.storchaka set messages: -
2017-06-15 17:01:02 serhiy.storchaka set messages: +
2017-06-15 16:58:43 serhiy.storchaka set messages: +
2017-05-31 18:58:39 serhiy.storchaka set nosy: + eric.smith, serhiy.storchakamessages: +
2017-05-25 01:34:16 rhettinger set nosy: + rhettingermessages: +
2017-05-24 22:57:05 lukasz.langa set pull_requests: + <pull%5Frequest1883>
2017-05-24 22:53:37 lukasz.langa create