Clarify as_str
@@ -1398,13 +1398,17 @@ class Readable:
return r
+def as_str(x):
+ """
+ Convert ASCII bytes to string.
+ Only expected to be used in Python 3.
+ """
+ return str(x, 'ascii')
try:
str(b'dummy', 'ascii')
except TypeError:
+ # Typically we get here in Python 2.
as_str = str
-else:
- def as_str(x):
- return str(x, 'ascii')
class Reader:
