Skip to content

Commit 4cfa7f0

Browse files
committed
pprinter: drop Python 2 unicode shim
The try/except block that defined unicode = str when unicode was not a builtin was Python 2 compatibility code. In Python 3, unicode does not exist; str is always correct. Drop the shim and use str directly. Signed-off-by: Matt Turner <mattst88@gentoo.org> Part-of: #62
1 parent 3d22104 commit 4cfa7f0

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

pym/gentoolkit/pprinter.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ def warn(string):
162162
return "!!! " + string + "\n"
163163

164164

165-
try:
166-
unicode
167-
except NameError:
168-
unicode = str
169-
170-
171165
def uprint(*args, **kw):
172166
"""Replacement for the builtin print function.
173167
@@ -199,7 +193,7 @@ def encoded_args():
199193
if isinstance(arg, bytes):
200194
yield arg
201195
else:
202-
yield unicode(arg).encode(encoding, "replace")
196+
yield str(arg).encode(encoding, "replace")
203197

204198
sep = sep.encode(encoding, "replace")
205199
end = end.encode(encoding, "replace")

0 commit comments

Comments
 (0)