New submission from Kyungdahm Yun <tom...@gmail.com>:

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

----------
components: Interpreter Core
messages: 338143
nosy: tomyun
priority: normal
severity: normal
status: open
title: compile() error on AST object with assignment expression
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36332>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to