Commit 29a110e2776 by Gregory Szorc

sha1dc: use proper string functions on Python 2/3

PyString_FromStringAndSize doesn't exist on Python 3: we need
to use PyUnicode_FromStringAndSize.

The extension now compiles without warnings on Python 2 and 3.

Differential Revision: https://phab.mercurial-scm.org/D7878
parent c3f741bb2f3
......@@ -95,7 +95,7 @@ static PyObject *pysha1ctx_hexdigest(pysha1ctx *self)
hexhash[i * 2] = hexdigit[hash[i] >> 4];
hexhash[i * 2 + 1] = hexdigit[hash[i] & 15];
}
return PyString_FromStringAndSize(hexhash, 40);
return PY23(PyString_FromStringAndSize, PyUnicode_FromStringAndSize)(hexhash, 40);
}
static PyTypeObject sha1ctxType;
......
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