[New-bugs-announce] [issue22606] Inconsistency between Python 2 and PyPy regarding future imports
report at bugs.python.org
Fri Oct 10 22:48:45 CEST 2014
New submission from Claudiu Popa:
The following code gives similar errors for both PyPy and Python 2 when called, but totally different AST objects.
Given the following code, PyPy says that `print(4)` is an _ast.Print, while Python 2 believes that it is an _ast.Expr (which wraps a Call). This behaviour is wrong, Python 2 shouldn't extrapolate further if the __future__ is misplaced.
from ast import parse
bad = """
a = 1
from __future__ import print_function
x = parse(bad)
Brett, I added you on this as nosy, since I discovered this bug while debugging your print-statement pull request, so I thought you should know. :-)
nosy: Claudiu.Popa, brett.cannon
title: Inconsistency between Python 2 and PyPy regarding future imports
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce