Message 338143 - Python tracker

Message338143

Author tomyun
Recipients tomyun
Date 2019-03-17.22:10:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552860650.83.0.184007481233.issue36332@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2019-03-17 22:10:50tomyunsetrecipients: + tomyun
2019-03-17 22:10:50tomyunsetmessageid: <1552860650.83.0.184007481233.issue36332@roundup.psfhosted.org>
2019-03-17 22:10:50tomyunlinkissue36332 messages
2019-03-17 22:10:50tomyuncreate