diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py index 83cf094..4c18089 100644 --- a/IPython/lib/pretty.py +++ b/IPython/lib/pretty.py @@ -84,7 +84,7 @@ import re import datetime from collections import deque -from IPython.utils.py3compat import PY3, PYPY, cast_unicode +from IPython.utils.py3compat import PYPY, cast_unicode from IPython.utils.encoding import get_stream_enc from io import StringIO @@ -108,15 +108,7 @@ def _safe_getattr(obj, attr, default=None): except Exception: return default -if PY3: - CUnicodeIO = StringIO -else: - class CUnicodeIO(StringIO): - """StringIO that casts str to unicode on Python 2""" - def write(self, text): - return super(CUnicodeIO, self).write( - cast_unicode(text, encoding=get_stream_enc(sys.stdout))) - +CUnicodeIO = StringIO def pretty(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH): """