##// END OF EJS Templates
save and restore ps1/ps2
Jason Newton -
Show More
@@ -251,6 +251,14 b' def embed(**kwargs):'
251 config = load_default_config()
251 config = load_default_config()
252 config.InteractiveShellEmbed = config.TerminalInteractiveShell
252 config.InteractiveShellEmbed = config.TerminalInteractiveShell
253 kwargs['config'] = config
253 kwargs['config'] = config
254 #save ps1/ps2 if defined
255 ps1 = None
256 ps2 = None
257 try:
258 ps1 = sys.ps1
259 ps2 = sys.ps2
260 except AttributeError:
261 pass
254 #save previous instance
262 #save previous instance
255 saved_shell_instance = InteractiveShell._instance
263 saved_shell_instance = InteractiveShell._instance
256 if saved_shell_instance is not None:
264 if saved_shell_instance is not None:
@@ -265,3 +273,6 b' def embed(**kwargs):'
265 cls.clear_instance()
273 cls.clear_instance()
266 for subclass in cls._walk_mro():
274 for subclass in cls._walk_mro():
267 subclass._instance = saved_shell_instance
275 subclass._instance = saved_shell_instance
276 if ps1 is not None:
277 sys.ps1 = ps1
278 sys.ps2 = ps2
General Comments 0
You need to be logged in to leave comments. Login now