From eac04547e680ea59d9d43527809b1c90b8565ab6 2008-08-14 22:06:52 From: Ville M. Vainio Date: 2008-08-14 22:06:52 Subject: [PATCH] ileo: _p does not get erased with recursive ipush / wb.require() --- diff --git a/IPython/Extensions/ipy_leo.py b/IPython/Extensions/ipy_leo.py index a829f3b..d83eb87 100644 --- a/IPython/Extensions/ipy_leo.py +++ b/IPython/Extensions/ipy_leo.py @@ -395,9 +395,13 @@ def push_ipython_script(node): hstart = len(ip.IP.input_hist) script = node.script() + # The current node _p needs to handle wb.require() and recursive ipushes + old_p = ip.user_ns.get('_p',None) ip.user_ns['_p'] = node ip.runlines(script) - ip.user_ns.pop('_p',None) + ip.user_ns['_p'] = old_p + if old_p is None: + del ip.user_ns['_p'] has_output = False for idx in range(hstart,len(ip.IP.input_hist)):