From 1059cf4772f993a804d1b05a66a94fafee379692 2015-07-29 16:24:54 From: Drekin Date: 2015-07-29 16:24:54 Subject: [PATCH] Support unicode returned by raw_input When a unicode string is returned by raw_input, it is now left alone rather than encoded to ascii when tried to be decoded, which lead to UnicodeEncodeError and IPython exit with inaccurate error message. --- diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index 0b28a30..1a66d2e 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -525,7 +525,7 @@ class TerminalInteractiveShell(InteractiveShell): prompt = py3compat.cast_bytes_py2(prompt) try: - line = py3compat.str_to_unicode(self.raw_input_original(prompt)) + line = py3compat.cast_unicode_py2(self.raw_input_original(prompt)) except ValueError: warn("\n********\nYou or a %run:ed script called sys.stdin.close()" " or sys.stdout.close()!\nExiting IPython!\n")