Roundup Robot added the comment:
New changeset a958b7f16a7d by Terry Jan Reedy in branch '2.7':
Issue #8515: Set __file__ when run file in IDLE. Backport 2c276d0553ff by
http://hg.python.org/cpython/rev/a958b7f16a7d
--
___
Python tracker
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 2c276d0553ff by Andrew Svetlov in branch 'default':
Issue #8515: Set __file__ when run file in IDLE.
http://hg.python.org/cpython/rev/2c276d0553ff
--
nosy: +python-dev
Andrew Svetlov andrew.svet...@gmail.com added the comment:
Thanks to all.
Bruce Frederiksen, you are mentioned in Misc/ACK
Tal Einat, if you want to make a patch which will use `execfile` instead of
current approach — you are welcome. Please file new issue.
--
assignee: - asvetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com:
--
nosy: +asvetlov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8515
___
___
Python-bugs-list
Roger Serwy roger.se...@gmail.com added the comment:
I've encountered this bug several times myself. I applied this patch and it
corrects the issue.
--
nosy: +serwy
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6
___
Python tracker
Bruce Frederiksen dangy...@gmail.com added the comment:
No, IDLE compiles the module (with the 'compile' built-in using the 'exec'
option) and then does an 'exec' on the code (in PyShell.py). It has several
lines of code that it runs before this exec to prepare the environment that
the code is
Changes by Éric Araujo mer...@netwok.org:
Removed file: http://bugs.python.org/file17632/unnamed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8515
___
Tal Einat talei...@users.sourceforge.net added the comment:
Why doesn't execfile() set __file__? I would be surprised if this is due to an
oversight by the Python devs. In both execfile and IDLE's Run Module I can't
think of a reason not to set __file__, but perhaps this was intentional?
New submission from Bruce Frederiksen dangy...@gmail.com:
The python CLI always sets the __file__ variable, whether run as:
$ python foobar.py
or
$ python -m foobar
or
$ python
import foobar # __file__ set in foobar module
The idle program sets the __file__ variable properly when you do