From 3cfbefe0cfada15c37a629b9ddd2c00b74363100 2014-08-07 21:24:55 From: Thomas Kluyver Date: 2014-08-07 21:24:55 Subject: [PATCH] Cast module name to bytes for Py2 ModuleType constructor Closes gh-6282 --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 7d7d0fe..b78654e 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -911,7 +911,8 @@ class InteractiveShell(SingletonConfigurable): try: main_mod = self._main_mod_cache[filename] except KeyError: - main_mod = self._main_mod_cache[filename] = types.ModuleType(modname, + main_mod = self._main_mod_cache[filename] = types.ModuleType( + py3compat.cast_bytes_py2(modname), doc="Module created for script run in IPython") else: main_mod.__dict__.clear()