##// END OF EJS Templates
Fixing InteractiveShell creation
Brian Granger -
Show More
@@ -23,19 +23,25 b' from IPython.core import ipapi'
23 #-----------------------------------------------------------------------------
23 #-----------------------------------------------------------------------------
24 # Globals
24 # Globals
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26 ip = ipapi.get()
27
26
28 if not '_refbug_cache' in ip.user_ns:
27 # This needs to be here because nose and other test runners will import
29 ip.user_ns['_refbug_cache'] = []
28 # this module. Importing this module has potential side effects that we
29 # want to prevent.
30 if __name__ == '__main__':
30
31
32 ip = ipapi.get()
31
33
32 aglobal = 'Hello'
34 if not '_refbug_cache' in ip.user_ns:
33 def f():
35 ip.user_ns['_refbug_cache'] = []
34 return aglobal
35
36
36 cache = ip.user_ns['_refbug_cache']
37 cache.append(f)
38
37
39 def call_f():
38 aglobal = 'Hello'
40 for func in cache:
39 def f():
41 print 'lowercased:',func().lower()
40 return aglobal
41
42 cache = ip.user_ns['_refbug_cache']
43 cache.append(f)
44
45 def call_f():
46 for func in cache:
47 print 'lowercased:',func().lower()
@@ -220,7 +220,7 b' class EmbeddedSphinxShell(object):'
220 config.InteractiveShell.colors = 'NoColor'
220 config.InteractiveShell.colors = 'NoColor'
221
221
222 # Create and initialize ipython, but don't start its mainloop
222 # Create and initialize ipython, but don't start its mainloop
223 IP = InteractiveShell(parent=None, config=config)
223 IP = InteractiveShell.instance(config=config)
224
224
225 # Store a few parts of IPython we'll need.
225 # Store a few parts of IPython we'll need.
226 self.IP = IP
226 self.IP = IP
General Comments 0
You need to be logged in to leave comments. Login now