Issue 36332: compile() error on AST object with assignment expression (original) (raw)
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", '', 'exec') <code object at 0x10a59ef60, file "", line 1> compile(ast.parse("if a == 1:\n True"), '', 'exec') <code object at 0x10a5f6780, file "", line 1> compile("if a := 1:\n True", '', 'exec') <code object at 0x10a59ef60, file "", line 1> compile(ast.parse("if a := 1:\n True"), '', 'exec') Traceback (most recent call last): File "", line 1, in SystemError: unexpected expression
This issue seems to break IPython when trying to use any assignment expressions. https://github.com/ipython/ipython/issues/11618