[IPython-dev] Bug in revision 1029+

Fernando Perez Fernando.Perez at colorado.edu
Sun Jan 22 03:04:18 CST 2006


Ville Vainio wrote:
> On 1/18/06, Jörgen Stenarson <jorgen.stenarson at bostream.nu> wrote:
> 
> 
>>Hi
>>
>>%run seems to have changed how it handles stack frames from revision
>>1029. The attached python file a.py and b.py works when executed from
> 
> 
> http://projects.scipy.org/ipython/ipython/changeset/1029
> 
> Apparently assigning the __file__ variable screws up "inspect" operations.
> 
> It all seems rather magical, perhaps there are also other evil side
> effects on assigning __file__? I'm thinking that perhaps we should
> leave __file__ unassigned after all.

Just a note: __file__ is a valid attribute that is supposed to exist in 
modules, so I don't think we should leave it unassigned.  We may be doing 
something incorrect with it (or it may be an inspect bug, there's a LOT of 
those), but we certainly should assing it.  I've put this in 0.7.1, please 
don't remove it unless you can ascertain that you have a full solution which 
covers normal use like:

In [1]: cat bug__file__.py
print '__file__ is:',__file__

In [2]: run bug__file__.py
__file__ is: bug__file__.py

and which helps with Jorgen's situation as well.

Cheers,

f




More information about the IPython-dev mailing list