Commit 257fed3f authored by Tres Seaver's avatar Tres Seaver

Py3.2: don't rely on binascii.unhexlify to convert under covers.

parent fd0d2b04
......@@ -557,7 +557,7 @@ class BushyLayout(object):
def path_to_oid(self, path):
if self.blob_path_pattern.match(path) is None:
raise ValueError("Not a valid OID path: `%s`" % path)
path = path.split(os.path.sep)
path = [bytes(x, 'ascii') for x in path.split(os.path.sep)]
# Each path segment stores a byte in hex representation. Turn it into
# an int and then get the character for our byte string.
oid = b''.join(binascii.unhexlify(byte[2:]) for byte in path)
......
......@@ -164,7 +164,9 @@ def oid_repr(oid):
return repr(oid)
def repr_to_oid(repr):
if repr.startswith("0x"):
if not isinstance(repr, bytes):
repr = bytes(repr, 'ascii')
if repr.startswith(b"0x"):
repr = repr[2:]
as_bin = unhexlify(repr)
as_bin = b"\x00"*(8-len(as_bin)) + as_bin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment