Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue36332

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:compile() error on AST object with assignment expression
Type:behaviorStage:resolved
Components:Interpreter CoreVersions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: emilyemorehouse, gvanrossum, pablogsal, serhiy.storchaka, tomyun
Priority:normalKeywords:patch

Created on2019-03-17 22:10 bytomyun, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 12398mergedpablogsal,2019-03-18 09:29
Messages (4)
msg338143 -(view)Author: Kyungdahm Yun (tomyun)Date: 2019-03-17 22:10
Seems like compile() can't properly handle assignment expressions parsed in AST object.Python 3.8.0a2+ (heads/master:06e1e68, Mar 17 2019, 14:27:19)[Clang 10.0.0 (clang-1000.10.44.4)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import ast>>> compile("if a == 1:\n  True", '<string>', 'exec')<code object <module> at 0x10a59ef60, file "<string>", line 1>>>> compile(ast.parse("if a == 1:\n  True"), '<string>', 'exec')<code object <module> at 0x10a5f6780, file "<string>", line 1>>>> compile("if a := 1:\n  True", '<string>', 'exec')<code object <module> at 0x10a59ef60, file "<string>", line 1>>>> compile(ast.parse("if a := 1:\n  True"), '<string>', 'exec')Traceback (most recent call last):  File "<stdin>", line 1, in <module>SystemError: unexpected expression>>>This issue seems to break IPython when trying to use any assignment expressions.https://github.com/ipython/ipython/issues/11618
msg338161 -(view)Author: Guido van Rossum (gvanrossum)*(Python committer)Date: 2019-03-18 04:14
Confirmed. Emily, do you need help tracking this down?
msg338163 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2019-03-18 06:25
validate_expr() needs a case for NamedExpr_kind.I think also that it is better to remove the "default" clause (and move its code after the switch statement) and allow the compiler to warn about missed cases.
msg338223 -(view)Author: Pablo Galindo Salgado (pablogsal)*(Python committer)Date: 2019-03-18 13:51
New changeset0c9258a6d299e0484538ef8d4b23f30515283db2 by Pablo Galindo in branch 'master':bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398)https://github.com/python/cpython/commit/0c9258a6d299e0484538ef8d4b23f30515283db2
History
DateUserActionArgs
2022-04-11 14:59:12adminsetgithub: 80513
2019-03-18 13:52:11pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-03-18 13:51:58pablogsalsetmessages: +msg338223
2019-03-18 09:31:18pablogsalsetnosy: +pablogsal
2019-03-18 09:29:01pablogsalsetkeywords: +patch
stage: patch review
pull_requests: +pull_request12353
2019-03-18 06:25:16serhiy.storchakasetnosy: +serhiy.storchaka
messages: +msg338163
2019-03-18 04:14:43gvanrossumsetmessages: +msg338161
2019-03-18 01:19:23xtreaksetnosy: +gvanrossum,emilyemorehouse
2019-03-17 22:10:50tomyuncreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp