Show More
@@ -1487,7 +1487,7 b' class InteractiveShell(object,Magic):' | |||||
1487 | return True |
|
1487 | return True | |
1488 | return ask_yes_no(prompt,default) |
|
1488 | return ask_yes_no(prompt,default) | |
1489 |
|
1489 | |||
1490 | def cache_main_mod(self,mod): |
|
1490 | def cache_main_mod(self,mod,fname=None): | |
1491 | """Cache a main module. |
|
1491 | """Cache a main module. | |
1492 |
|
1492 | |||
1493 | When scripts are executed via %run, we must keep a reference to their |
|
1493 | When scripts are executed via %run, we must keep a reference to their | |
@@ -1515,7 +1515,10 b' class InteractiveShell(object,Magic):' | |||||
1515 | In [12]: IPython.__file__ in _ip.IP._user_main_modules |
|
1515 | In [12]: IPython.__file__ in _ip.IP._user_main_modules | |
1516 | Out[12]: True |
|
1516 | Out[12]: True | |
1517 | """ |
|
1517 | """ | |
1518 | self._user_main_modules[os.path.abspath(mod.__file__) ] = mod |
|
1518 | if fname is None: | |
|
1519 | fname = mod.__file__ | |||
|
1520 | #print >> sys.stderr, 'CFNAME :', os.path.abspath(fname) # dbg | |||
|
1521 | self._user_main_modules[os.path.abspath(fname)] = mod | |||
1519 |
|
1522 | |||
1520 | def clear_main_mod_cache(self): |
|
1523 | def clear_main_mod_cache(self): | |
1521 | """Clear the cache of main modules. |
|
1524 | """Clear the cache of main modules. |
@@ -131,3 +131,19 b' def test_fail_dec2(*a,**k):' | |||||
131 | def test_fail_dec3(*a,**k): |
|
131 | def test_fail_dec3(*a,**k): | |
132 | yield nt.assert_true, False |
|
132 | yield nt.assert_true, False | |
133 |
|
133 | |||
|
134 | ||||
|
135 | def doctest_refbug(): | |||
|
136 | """Very nasty problem with references held by multiple runs of a script. | |||
|
137 | See: https://bugs.launchpad.net/ipython/+bug/269966 | |||
|
138 | ||||
|
139 | In [2]: run refbug | |||
|
140 | ||||
|
141 | In [3]: call_f() | |||
|
142 | lowercased: hello | |||
|
143 | ||||
|
144 | In [4]: run refbug | |||
|
145 | ||||
|
146 | In [5]: call_f() | |||
|
147 | lowercased: hello | |||
|
148 | lowercased: hello | |||
|
149 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now