##// END OF EJS Templates
- fix missing __file__ for scripts run via %run....
fperez -
Show More
@@ -15,7 +15,7 b' details on the PSF (Python Software Foundation) standard license, see:'
15 15
16 16 http://www.python.org/2.2.3/license.html
17 17
18 $Id: Debugger.py 994 2006-01-08 08:29:44Z fperez $"""
18 $Id: Debugger.py 1029 2006-01-18 07:33:38Z fperez $"""
19 19
20 20 #*****************************************************************************
21 21 #
@@ -66,12 +66,22 b' def _file_lines(fname):'
66 66
67 67 class Pdb(pdb.Pdb):
68 68 """Modified Pdb class, does not load readline."""
69
70 # Ugly hack: we can't call the parent constructor, because it binds
71 # readline and breaks tab-completion. This means we have to COPY the
72 # constructor here, and that requires tracking various python versions.
73
69 74 def __init__(self,color_scheme='NoColor'):
70 75 bdb.Bdb.__init__(self)
71 76 cmd.Cmd.__init__(self,completekey=None) # don't load readline
72 77 self.prompt = 'ipdb> ' # The default prompt is '(Pdb)'
73 78 self.aliases = {}
74 79
80 # These two lines are part of the py2.4 constructor, let's put them
81 # unconditionally here as they won't cause any problems in 2.3.
82 self.mainpyfile = ''
83 self._wait_for_mainpyfile = 0
84
75 85 # Read $HOME/.pdbrc and ./.pdbrc
76 86 try:
77 87 self.rcLines = _file_lines(os.path.join(os.environ['HOME'],
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 1023 2006-01-16 19:11:21Z vivainio $"""
4 $Id: Magic.py 1029 2006-01-18 07:33:38Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -1396,6 +1396,10 b' Currently the magic system has the following functions:\\n"""'
1396 1396 name = '__main__'
1397 1397 prog_ns = {'__name__':name}
1398 1398
1399 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1400 # set the __file__ global in the script's namespace
1401 prog_ns['__file__'] = filename
1402
1399 1403 # pickle fix. See iplib for an explanation. But we need to make sure
1400 1404 # that, if we overwrite __main__, we replace it at the end
1401 1405 if prog_ns['__name__'] == '__main__':
@@ -1,3 +1,15 b''
1 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Magic.py (magic_run): fix __file__ global missing from
4 script's namespace when executed via %run. After a report by
5 Vivian.
6
7 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
8 when using python 2.4. The parent constructor changed in 2.4, and
9 we need to track it directly (we can't call it, as it messes up
10 readline and tab-completion inside our pdb would stop working).
11 After a bug report by R. Bernstein <rocky-AT-panix.com>.
12
1 13 2006-01-16 Ville Vainio <vivainio@gmail.com>
2 14
3 15 * Ipython/magic.py:Reverted back to old %edit functionality
General Comments 0
You need to be logged in to leave comments. Login now