##// END OF EJS Templates
More Python 3 compatibility fixes in core.
Thomas Kluyver -
Show More
@@ -29,6 +29,7 b' from StringIO import StringIO'
29 29 from IPython.config.configurable import Configurable
30 30 from IPython.lib import pretty
31 31 from IPython.utils.traitlets import Bool, Dict, Int, Unicode, CUnicode, ObjectName
32 from IPython.utils.py3compat import unicode_to_str
32 33
33 34
34 35 #-----------------------------------------------------------------------------
@@ -439,7 +440,7 b' class PlainTextFormatter(BaseFormatter):'
439 440 # ensure that stream does not get a mix of unicode and bytestrings,
440 441 # or it will cause trouble.
441 442 printer = pretty.RepresentationPrinter(stream, self.verbose,
442 self.max_width, self.newline.encode(),
443 self.max_width, unicode_to_str(self.newline),
443 444 singleton_pprinters=self.singleton_printers,
444 445 type_pprinters=self.type_printers,
445 446 deferred_pprinters=self.deferred_printers)
@@ -75,6 +75,7 b' from StringIO import StringIO'
75 75
76 76 # IPython modules
77 77 from IPython.utils.text import make_quoted_expr
78 from IPython.utils.py3compat import cast_unicode
78 79
79 80 #-----------------------------------------------------------------------------
80 81 # Globals
@@ -837,8 +838,7 b' class IPythonInputSplitter(InputSplitter):'
837 838 return super(IPythonInputSplitter, self).push(lines)
838 839
839 840 # We must ensure all input is pure unicode
840 if type(lines)==str:
841 lines = lines.decode(self.encoding)
841 lines = cast_unicode(lines, self.encoding)
842 842
843 843 lines_list = lines.splitlines()
844 844
General Comments 0
You need to be logged in to leave comments. Login now