Python 2: Return a byte string for hex oids

This commit is contained in:
J. David Ibáñez
2013-04-20 10:09:52 +02:00
parent fd67685500
commit fbd93f82aa

View File

@@ -150,7 +150,12 @@ git_oid_to_py_str(const git_oid *oid)
char hex[GIT_OID_HEXSZ]; char hex[GIT_OID_HEXSZ];
git_oid_fmt(hex, oid); git_oid_fmt(hex, oid);
#if PY_MAJOR_VERSION == 2
return PyBytes_FromStringAndSize(hex, GIT_OID_HEXSZ);
#else
return to_unicode_n(hex, GIT_OID_HEXSZ, "utf-8", "strict"); return to_unicode_n(hex, GIT_OID_HEXSZ, "utf-8", "strict");
#endif
} }