[pypy-issue] [issue795] AST compiler ignores future imports that change semantics

Armin Ronacher tracker at bugs.pypy.org
Thu Jul 14 10:41:50 CEST 2011


New submission from Armin Ronacher <armin.ronacher at active-4.com>:

Right now the PyPy AST compiler seems to ignore the division future import.  It
might also affect some others.


import ast

ns = {}
exec compile(ast.fix_missing_locations(ast.Module([
    ast.ImportFrom('__future__', [ast.alias('division', None)], -1),
    ast.Assign([ast.Name('result', ast.Store())],
               ast.BinOp(ast.Num(10), ast.Div(), ast.Num(4)))
])), '<string>', 'exec') in ns

print 'Expecting 2.5, got %r' % ns['result']


Prints 2.5 on Python, but 2 on PyPy.

----------
assignedto: benjamin
messages: 2802
nosy: benjamin, mitsuhiko, pypy-issue
priority: bug
status: unread
title: AST compiler ignores future imports that change semantics

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue795>
________________________________________


More information about the pypy-issue mailing list