##// END OF EJS Templates
Merge branch 'i597'
Thomas Kluyver -
r4377:6b2de8fd merge
parent child Browse files
Show More
@@ -432,8 +432,11 b' class PlainTextFormatter(BaseFormatter):'
432 432 else:
433 433 # This uses use StringIO, as cStringIO doesn't handle unicode.
434 434 stream = StringIO()
435 # self.newline.encode() is a quick fix for issue gh-597. We need to
436 # ensure that stream does not get a mix of unicode and bytestrings,
437 # or it will cause trouble.
435 438 printer = pretty.RepresentationPrinter(stream, self.verbose,
436 self.max_width, self.newline,
439 self.max_width, self.newline.encode(),
437 440 singleton_pprinters=self.singleton_printers,
438 441 type_pprinters=self.type_printers,
439 442 deferred_pprinters=self.deferred_printers)
@@ -112,5 +112,13 b' class InteractiveShellTestCase(unittest.TestCase):'
112 112 ip = get_ipython()
113 113 ip.run_cell('!(true)\n', False)
114 114 ip.run_cell('!(true)\n\n\n', False)
115
116
115
116 def test_gh_597(self):
117 """Pretty-printing lists of objects with non-ascii reprs may cause
118 problems."""
119 class Spam(object):
120 def __repr__(self):
121 return "\xe9"*50
122 import IPython.core.formatters
123 f = IPython.core.formatters.PlainTextFormatter()
124 f([Spam(),Spam()])
General Comments 0
You need to be logged in to leave comments. Login now