Skip to content

Commit 3d155cc

Browse files
author
y-p
committed
BLD/DOC: ip_directive use py3 compat text_type
1 parent 67f04c1 commit 3d155cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/sphinxext/ipython_directive.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@
134134

135135
if PY3:
136136
from io import StringIO
137+
text_type = str
137138
else:
138139
from StringIO import StringIO
140+
text_type = unicode
139141

140142
#-----------------------------------------------------------------------------
141143
# Globals
@@ -255,8 +257,7 @@ def set_encodings(self, encodings):
255257
self.encodings = encodings
256258

257259
def write(self,data):
258-
#py 3 compat here
259-
if isinstance(data,unicode):
260+
if isinstance(data, text_type):
260261
return super(DecodingStringIO, self).write(data)
261262
else:
262263
for enc in self.encodings:

0 commit comments

Comments
 (0)