Issue 32376: Unusable syntax error reported when Python keyword in a f-string
Issue32376
Created on 2017-12-19 15:59 by Dmitry sky, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| fstring.py | Dmitry sky, 2017-12-19 15:59 | |||
| Messages (3) | |||
|---|---|---|---|
| msg308657 - (view) | Author: Dmitry sky (Dmitry sky) | Date: 2017-12-19 15:59 | |
def get_search_url(from_, to):
return f"http://thesite.com/Search?SO0={from_}&SD0={to}&SD1={from}&NA=false"
# pls note `from_` vs `from` ^^^^^^
$ python fstring.py
File "<fstring>", line 1
(from)
^
SyntaxError: invalid syntax
Should report real line #.
|
|||
| msg308659 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2017-12-19 16:11 | |
Yes, this is a real problem. I think there's already an issue for this, but I can't find it. Unfortunately, to fix it requires a bit of refactoring on how line numbers and errors are tracked. It's on my list of things to do. |
|||
| msg308684 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2017-12-19 21:08 | |
The existing issue is #29051. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:55 | admin | set | github: 76557 |
| 2017-12-19 21:08:10 | r.david.murray | set | status: open -> closed superseder: Improve error reporting involving f-strings (PEP 498) nosy:
+ r.david.murray |
| 2017-12-19 16:11:45 | eric.smith | set | nosy:
+ eric.smith messages:
+ msg308659 |
| 2017-12-19 15:59:56 | Dmitry sky | create | |
