diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index d084aa7..1c91b64 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -186,6 +186,11 @@ class ReadlineNoRecord(object): ghi = self.shell.readline.get_history_item return [ghi(x) for x in range(start, end)] + +class DummyMod(object): + "A dummy module used for IPython's interactive namespace." + pass + #----------------------------------------------------------------------------- # Main IPython class #----------------------------------------------------------------------------- @@ -1035,9 +1040,6 @@ class InteractiveShell(SingletonConfigurable): """ if user_module is None and user_ns is not None: user_ns.setdefault("__name__", "__main__") - class DummyMod(object): - "A dummy module used for IPython's interactive namespace." - pass user_module = DummyMod() user_module.__dict__ = user_ns diff --git a/IPython/terminal/embed.py b/IPython/terminal/embed.py index bd48141..0a0128c 100644 --- a/IPython/terminal/embed.py +++ b/IPython/terminal/embed.py @@ -29,6 +29,7 @@ import warnings from IPython.core import ultratb, compilerop from IPython.core.magic import Magics, magics_class, line_magic +from IPython.core.interactiveshell import DummyMod from IPython.terminal.interactiveshell import TerminalInteractiveShell from IPython.terminal.ipapp import load_default_config @@ -185,9 +186,6 @@ class InteractiveShellEmbed(TerminalInteractiveShell): there is no fundamental reason why it can't work perfectly.""" if (global_ns is not None) and (module is None): - class DummyMod(object): - """A dummy module object for embedded IPython.""" - pass warnings.warn("global_ns is deprecated, use module instead.", DeprecationWarning) module = DummyMod() module.__dict__ = global_ns