[IPython-dev] Bug in revision 1029+
vivainio at gmail.com
Wed Jan 18 15:22:52 CST 2006
On 1/18/06, Jörgen Stenarson <jorgen.stenarson at bostream.nu> wrote:
> %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
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.
Though what you are doing here doesn't seem too safe/predictable either :-).
> I use this technique to get a function that can return the source of the
> module that the caller is in. If someone knows a better way I'd love
> to hear it.
I don't have much time for this right now, but why do you use
inspect.getmodule and inspect.getsource? Now that I'm looking at
inspect.stack() contents, it seems to have the file name and line
number directly available...
Ville Vainio - http://tinyurl.com/2prnb
More information about the IPython-dev