##// END OF EJS Templates
Deprecate __IPYTHON__active for simply __IPYTHON__
Fernando Perez -
Show More
@@ -102,11 +102,6 b' class BuiltinTrap(Configurable):'
102 for name, func in self.auto_builtins.iteritems():
102 for name, func in self.auto_builtins.iteritems():
103 add_builtin(name, func)
103 add_builtin(name, func)
104
104
105 # Keep in the builtins a flag for when IPython is active. We set it
106 # with setdefault so that multiple nested IPythons don't clobber one
107 # another.
108 __builtin__.__dict__.setdefault('__IPYTHON__active', 0)
109
110 def deactivate(self):
105 def deactivate(self):
111 """Remove any builtins which might have been added by add_builtins, or
106 """Remove any builtins which might have been added by add_builtins, or
112 restore overwritten ones to their previous values."""
107 restore overwritten ones to their previous values."""
@@ -115,7 +110,3 b' class BuiltinTrap(Configurable):'
115 remove_builtin(key, val)
110 remove_builtin(key, val)
116 self._orig_builtins.clear()
111 self._orig_builtins.clear()
117 self._builtins_added = False
112 self._builtins_added = False
118 try:
119 del __builtin__.__dict__['__IPYTHON__active']
120 except KeyError:
121 pass
@@ -573,6 +573,20 b' class InteractiveShell(SingletonConfigurable, Magic):'
573 self.magic_logstart()
573 self.magic_logstart()
574
574
575 def init_builtins(self):
575 def init_builtins(self):
576 # A single, static flag that we set to True. Its presence indicates
577 # that an IPython shell has been created, and we make no attempts at
578 # removing on exit or representing the existence of more than one
579 # IPython at a time.
580 builtin_mod.__dict__['__IPYTHON__'] = True
581
582 # In 0.11 we introduced '__IPYTHON__active' as an integer we'd try to
583 # manage on enter/exit, but with all our shells it's virtually
584 # impossible to get all the cases right. We're leaving the name in for
585 # those who adapted their codes to check for this flag, but will
586 # eventually remove it after a few more releases.
587 builtin_mod.__dict__['__IPYTHON__active'] = \
588 'Deprecated, check for __IPYTHON__'
589
576 self.builtin_trap = BuiltinTrap(shell=self)
590 self.builtin_trap = BuiltinTrap(shell=self)
577
591
578 def init_inspector(self):
592 def init_inspector(self):
@@ -341,9 +341,6 b' class TerminalInteractiveShell(InteractiveShell):'
341
341
342 more = False
342 more = False
343
343
344 # Mark activity in the builtins
345 __builtin__.__dict__['__IPYTHON__active'] += 1
346
347 if self.has_readline:
344 if self.has_readline:
348 self.readline_startup_hook(self.pre_readline)
345 self.readline_startup_hook(self.pre_readline)
349 hlen_b4_cell = self.readline.get_current_history_length()
346 hlen_b4_cell = self.readline.get_current_history_length()
@@ -413,9 +410,6 b' class TerminalInteractiveShell(InteractiveShell):'
413 hlen_b4_cell = \
410 hlen_b4_cell = \
414 self._replace_rlhist_multiline(source_raw, hlen_b4_cell)
411 self._replace_rlhist_multiline(source_raw, hlen_b4_cell)
415
412
416 # We are off again...
417 __builtin__.__dict__['__IPYTHON__active'] -= 1
418
419 # Turn off the exit flag, so the mainloop can be restarted if desired
413 # Turn off the exit flag, so the mainloop can be restarted if desired
420 self.exit_now = False
414 self.exit_now = False
421
415
General Comments 0
You need to be logged in to leave comments. Login now