##// END OF EJS Templates
Merge pull request #10142 from srinivasreddy/CUnicodeIO...
Thomas Kluyver -
r23127:b7a7f0b0 merge
parent child Browse files
Show More
@@ -15,6 +15,7 b' import json'
15 15 import sys
16 16 import traceback
17 17 import warnings
18 from io import StringIO
18 19
19 20 from decorator import decorator
20 21
@@ -655,11 +656,7 b' class PlainTextFormatter(BaseFormatter):'
655 656 if not self.pprint:
656 657 return repr(obj)
657 658 else:
658 # handle str and unicode on Python 2
659 # io.StringIO only accepts unicode,
660 # cStringIO doesn't handle unicode on py2,
661 # StringIO allows str, unicode but only ascii str
662 stream = pretty.CUnicodeIO()
659 stream = StringIO()
663 660 printer = pretty.RepresentationPrinter(stream, self.verbose,
664 661 self.max_width, self.newline,
665 662 max_seq_length=self.max_seq_length,
@@ -83,12 +83,11 b' import types'
83 83 import re
84 84 import datetime
85 85 from collections import deque
86 from io import StringIO
86 87
87 88 from IPython.utils.py3compat import PYPY, cast_unicode
88 89 from IPython.utils.encoding import get_stream_enc
89 90
90 from io import StringIO
91
92 91
93 92 __all__ = ['pretty', 'pprint', 'PrettyPrinter', 'RepresentationPrinter',
94 93 'for_type', 'for_type_by_name']
@@ -114,7 +113,7 b" def pretty(obj, verbose=False, max_width=79, newline='\\n', max_seq_length=MAX_SE"
114 113 """
115 114 Pretty print the object's representation.
116 115 """
117 stream = CUnicodeIO()
116 stream = StringIO()
118 117 printer = RepresentationPrinter(stream, verbose, max_width, newline, max_seq_length=max_seq_length)
119 118 printer.pretty(obj)
120 119 printer.flush()
General Comments 0
You need to be logged in to leave comments. Login now