summaryrefslogtreecommitdiff
path: root/coverage/backward.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/backward.py')
-rw-r--r--coverage/backward.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/coverage/backward.py b/coverage/backward.py
index 720cd3e1..0df2a41e 100644
--- a/coverage/backward.py
+++ b/coverage/backward.py
@@ -106,6 +106,10 @@ if env.PY3:
"""Convert string `s` to bytes."""
return s.encode('utf8')
+ def to_string(b):
+ """Convert bytes `b` to string."""
+ return b.decode('utf8')
+
def binary_bytes(byte_values):
"""Produce a byte string with the ints from `byte_values`."""
return bytes(byte_values)
@@ -120,6 +124,10 @@ else:
"""Convert string `s` to bytes (no-op in 2.x)."""
return s
+ def to_string(b):
+ """Convert bytes `b` to string."""
+ return b
+
def binary_bytes(byte_values):
"""Produce a byte string with the ints from `byte_values`."""
return "".join(chr(b) for b in byte_values)