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 0df2a41e..34ab2f1a 100644
--- a/coverage/backward.py
+++ b/coverage/backward.py
@@ -114,6 +114,10 @@ if env.PY3:
"""Produce a byte string with the ints from `byte_values`."""
return bytes(byte_values)
+ def byte_to_int(byte):
+ """Turn a byte indexed from a bytes object into an int."""
+ return byte
+
def bytes_to_ints(bytes_value):
"""Turn a bytes object into a sequence of ints."""
# In Python 3, iterating bytes gives ints.
@@ -132,6 +136,10 @@ else:
"""Produce a byte string with the ints from `byte_values`."""
return "".join(chr(b) for b in byte_values)
+ def byte_to_int(byte):
+ """Turn a byte indexed from a bytes object into an int."""
+ return ord(byte)
+
def bytes_to_ints(bytes_value):
"""Turn a bytes object into a sequence of ints."""
for byte in bytes_value: