[issue23069] IDLE's F5 Run Module doesn't transfer effects of future import

Raymond Hettinger report at bugs.python.org
Wed Dec 17 03:30:30 CET 2014


New submission from Raymond Hettinger:

Future imports in a module aren't transferring to the interactive shell when executing Run Module.

Given the file tmp_future.py
----------------------------
$ cat tmp_future.py
from __future__ import division, print_function

print(32 / 5)

Run Python interactively
------------------------
$ python2.7 -i tmp_future.py 
6.4
>>> 32 / 5          # this works fine!
6.4

But open the file in IDLE and press F5:
---------------------------------------
Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
6.4
>>> print(32 / 5)       # this is broken!
6

Note, the problem may also apply to IDLE Python 3.4 and 3.5 but it won't affect this example because the future imports have not effect.

----------
components: IDLE
files: tmp_future.py
messages: 232794
nosy: rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE's F5 Run Module doesn't transfer effects of future import
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file37477/tmp_future.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23069>
_______________________________________


More information about the Python-bugs-list mailing list