Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue35494

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Inaccurate error message for f-string
Type:enhancementStage:resolved
Components:Interpreter CoreVersions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:33306Superseder:
Assigned To: serhiy.storchakaNosy List: eric.smith, seblin, serhiy.storchaka
Priority:normalKeywords:patch

Created on2018-12-14 13:34 byseblin, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 11161mergedserhiy.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)*(Python committer)Date: 2018-12-14 14:04
I can take this issue if you do not mind.
msg331832 -(view)Author: Eric V. Smith (eric.smith)*(Python committer)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)*(Python committer)Date: 2018-12-14 16:13
PR 11161 uses an approach similar toissue33306.
msg333521 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)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
DateUserActionArgs
2022-04-11 14:59:09adminsetgithub: 79675
2019-01-12 07:47:17serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-01-12 07:46:52serhiy.storchakasetmessages: +msg333521
2018-12-14 16:14:02serhiy.storchakasettype: enhancement
versions: + Python 3.8, - Python 3.7
2018-12-14 16:13:49serhiy.storchakasetdependencies: +Improving SyntaxError for unmatched parentheses
messages: +msg331839
2018-12-14 16:12:32serhiy.storchakasetkeywords: +patch
stage: patch review
pull_requests: +pull_request10397
2018-12-14 14:56:07seblinsetmessages: +msg331833
2018-12-14 14:36:25eric.smithsetassignee:eric.smith ->serhiy.storchaka
messages: +msg331832
2018-12-14 14:04:32serhiy.storchakasetnosy: +serhiy.storchaka
messages: +msg331828
2018-12-14 13:40:48eric.smithsetassignee:eric.smith

nosy: +eric.smith
2018-12-14 13:34:17seblincreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp