
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2018-12-14 13:34 byseblin, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11161 | merged | serhiy.storchaka,2018-12-14 16:12 | |
| Messages (6) | |||
|---|---|---|---|
| msg331827 -(view) | Author: Sebastian Linke (seblin) | Date: 2018-12-14 13:34 | |
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> spam = 'spam'>>> f'{spam[0}' File "<stdin>", line 1SyntaxError: f-string: expecting '}'The error message seems wrong because a "]" is missing rather than a "}". | |||
| msg331828 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2018-12-14 14:04 | |
I can take this issue if you do not mind. | |||
| msg331832 -(view) | Author: Eric V. Smith (eric.smith)*![]() | Date: 2018-12-14 14:36 | |
Go ahead, Serhiy. Thanks! | |||
| msg331833 -(view) | Author: Sebastian Linke (seblin) | Date: 2018-12-14 14:56 | |
The same behavior applies to f'{spam[}' and f'{spam(}'. Also to f'{spam{}', but that might be expected.This message is more clear:>>> f'{spam(' File "<stdin>", line 1SyntaxError: f-string: mismatched '(', '{', or '['Perhaps you want to apply that to the above error cases. Then you wouldn't have to catch any type of bracket. :-) | |||
| msg331839 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2018-12-14 16:13 | |
PR 11161 uses an approach similar toissue33306. | |||
| msg333521 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2019-01-12 07:46 | |
New changeset58159ef856846d0235e0779aeb6013d70499570d by Serhiy Storchaka in branch 'master':bpo-35494: Improve syntax error messages for unbalanced parentheses in f-string. (GH-11161)https://github.com/python/cpython/commit/58159ef856846d0235e0779aeb6013d70499570d | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:09 | admin | set | github: 79675 |
| 2019-01-12 07:47:17 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-01-12 07:46:52 | serhiy.storchaka | set | messages: +msg333521 |
| 2018-12-14 16:14:02 | serhiy.storchaka | set | type: enhancement versions: + Python 3.8, - Python 3.7 |
| 2018-12-14 16:13:49 | serhiy.storchaka | set | dependencies: +Improving SyntaxError for unmatched parentheses messages: +msg331839 |
| 2018-12-14 16:12:32 | serhiy.storchaka | set | keywords: +patch stage: patch review pull_requests: +pull_request10397 |
| 2018-12-14 14:56:07 | seblin | set | messages: +msg331833 |
| 2018-12-14 14:36:25 | eric.smith | set | assignee:eric.smith ->serhiy.storchaka messages: +msg331832 |
| 2018-12-14 14:04:32 | serhiy.storchaka | set | nosy: +serhiy.storchaka messages: +msg331828 |
| 2018-12-14 13:40:48 | eric.smith | set | assignee:eric.smith nosy: +eric.smith |
| 2018-12-14 13:34:17 | seblin | create | |