Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ def get_readline_tail(self, n=10):
ghi = self.shell.readline.get_history_item
return [ghi(x) for x in range(start, end)]


@undoc
class DummyMod(object):
"""A dummy module used for IPython's interactive module when
a namespace must be assigned to the module's __dict__."""
pass

#-----------------------------------------------------------------------------
# Main IPython class
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1035,9 +1042,6 @@ def prepare_user_module(self, user_module=None, user_ns=None):
"""
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

Expand Down
4 changes: 1 addition & 3 deletions IPython/terminal/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

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

Expand Down Expand Up @@ -185,9 +186,6 @@ def mainloop(self, local_ns=None, module=None, stack_depth=0,
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
Expand Down