Issue36332
Created on 2019-03-17 22:10 by tomyun, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 12398 | merged | pablogsal, 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 darwin
Type "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) * | Date: 2019-03-18 04:14 | |
Confirmed. Emily, do you need help tracking this down? |
|||
| msg338163 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | 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) * | Date: 2019-03-18 13:51 | |
New changeset 0c9258a6d299e0484538ef8d4b23f30515283db2 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 | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:12 | admin | set | github: 80513 |
| 2019-03-18 13:52:11 | pablogsal | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-03-18 13:51:58 | pablogsal | set | messages: + msg338223 |
| 2019-03-18 09:31:18 | pablogsal | set | nosy:
+ pablogsal |
| 2019-03-18 09:29:01 | pablogsal | set | keywords:
+ patch stage: patch review pull_requests: + pull_request12353 |
| 2019-03-18 06:25:16 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg338163 |
| 2019-03-18 04:14:43 | gvanrossum | set | messages: + msg338161 |
| 2019-03-18 01:19:23 | xtreak | set | nosy:
+ gvanrossum, emilyemorehouse |
| 2019-03-17 22:10:50 | tomyun | create | |