From e54183d96ef3b4797577c6dd2f755ab0e233e2c1 2016-12-24 18:12:50 From: Srinivas Reddy Thatiparthy Date: 2016-12-24 18:12:50 Subject: [PATCH] remove the function unicode_to_str as in python3 it has become redundant --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 70185d5..45050b0 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2202,14 +2202,12 @@ class InteractiveShell(SingletonConfigurable): with AvoidUNCPath() as path: if path is not None: cmd = '"pushd %s &&"%s' % (path, cmd) - cmd = py3compat.unicode_to_str(cmd) try: ec = os.system(cmd) except KeyboardInterrupt: print('\n' + self.get_exception_only(), file=sys.stderr) ec = -2 else: - cmd = py3compat.unicode_to_str(cmd) # For posix the result of the subprocess.call() below is an exit # code, which by convention is zero for success, positive for # program failure. Exit codes above 128 are reserved for signals, diff --git a/IPython/core/macro.py b/IPython/core/macro.py index 367998b..efc2968 100644 --- a/IPython/core/macro.py +++ b/IPython/core/macro.py @@ -37,7 +37,7 @@ class Macro(object): self.value = code + '\n' def __str__(self): - return py3compat.unicode_to_str(self.value) + return self.value def __unicode__(self): return self.value diff --git a/IPython/core/tests/test_application.py b/IPython/core/tests/test_application.py index fb7724f..0808712 100644 --- a/IPython/core/tests/test_application.py +++ b/IPython/core/tests/test_application.py @@ -42,7 +42,7 @@ def test_unicode_ipdir(): old_ipdir1 = os.environ.pop("IPYTHONDIR", None) old_ipdir2 = os.environ.pop("IPYTHON_DIR", None) - os.environ["IPYTHONDIR"] = py3compat.unicode_to_str(ipdir, "utf-8") + os.environ["IPYTHONDIR"] = ipdir try: app = BaseIPythonApplication() # The lines below are copied from Application.initialize() diff --git a/IPython/utils/path.py b/IPython/utils/path.py index 0f900b4..d54a709 100644 --- a/IPython/utils/path.py +++ b/IPython/utils/path.py @@ -87,7 +87,7 @@ def unquote_filename(name, win32=(sys.platform=='win32')): def compress_user(path): """Reverse of :func:`os.path.expanduser` """ - path = py3compat.unicode_to_str(path, sys.getfilesystemencoding()) + path = str(path) home = os.path.expanduser('~') if path.startswith(home): path = "~" + path[len(home):]