##// END OF EJS Templates
use Singleton.instance() for embed() instead of manual global...
MinRK -
Show More
@@ -264,8 +264,6 b' class InteractiveShellEmbed(TerminalInteractiveShell):'
264 self.user_ns = orig_user_ns
264 self.user_ns = orig_user_ns
265 self.compile.flags = orig_compile_flags
265 self.compile.flags = orig_compile_flags
266
266
267 _embedded_shell = None
268
269
267
270 def embed(**kwargs):
268 def embed(**kwargs):
271 """Call this to embed IPython at the current point in your program.
269 """Call this to embed IPython at the current point in your program.
@@ -284,7 +282,7 b' def embed(**kwargs):'
284 d = 40
282 d = 40
285 embed
283 embed
286
284
287 Full customization can be done by passing a :class:`Struct` in as the
285 Full customization can be done by passing a :class:`Config` in as the
288 config argument.
286 config argument.
289 """
287 """
290 config = kwargs.get('config')
288 config = kwargs.get('config')
@@ -294,7 +292,5 b' def embed(**kwargs):'
294 config = load_default_config()
292 config = load_default_config()
295 config.InteractiveShellEmbed = config.TerminalInteractiveShell
293 config.InteractiveShellEmbed = config.TerminalInteractiveShell
296 kwargs['config'] = config
294 kwargs['config'] = config
297 global _embedded_shell
295 shell = InteractiveShellEmbed.instance(**kwargs)
298 if _embedded_shell is None:
296 shell(header=header, stack_depth=2, compile_flags=compile_flags)
299 _embedded_shell = InteractiveShellEmbed(**kwargs)
300 _embedded_shell(header=header, stack_depth=2, compile_flags=compile_flags)
General Comments 0
You need to be logged in to leave comments. Login now