From 9660fbeabae619a4d562c9e99fc80a19b1a70802 2007-12-30 22:42:25 From: vivainio Date: 2007-12-30 22:42:25 Subject: [PATCH] Store _ip in user_ns now, instead of __builtin__. Closes #197 and probably zillion other bugs with embedded ipython instances --- diff --git a/IPython/ipapi.py b/IPython/ipapi.py index aecf30e..c0cf5e4 100644 --- a/IPython/ipapi.py +++ b/IPython/ipapi.py @@ -186,6 +186,7 @@ class IPApi: self.set_custom_exc = ip.set_custom_exc self.user_ns = ip.user_ns + self.user_ns['_ip'] = self self.set_crash_handler = ip.set_crash_handler diff --git a/IPython/iplib.py b/IPython/iplib.py index 3447e13..379566e 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.3 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 2908 2007-12-30 21:07:46Z vivainio $ +$Id: iplib.py 2910 2007-12-30 22:42:25Z vivainio $ """ #***************************************************************************** @@ -728,15 +728,14 @@ class InteractiveShell(object,Magic): Some parts of ipython operate via builtins injected here, which hold a reference to IPython itself.""" - # TODO: deprecate all except _ip; 'jobs' should be installed - # by an extension and the rest are under _ip, ipalias is redundant + # TODO: deprecate all of these, they are unsafe builtins_new = dict(__IPYTHON__ = self, ip_set_hook = self.set_hook, jobs = self.jobs, ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'), ipalias = wrap_deprecated(self.ipalias), ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'), - _ip = self.api + #_ip = self.api ) for biname,bival in builtins_new.items(): try: