Mercurial > hg
changeset 44083:29a110e2776e
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
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 14 Jan 2020 17:53:43 -0800 |
parents | c3f741bb2f33 |
children | 84f2becbd106 |
files | mercurial/thirdparty/sha1dc/cext.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/thirdparty/sha1dc/cext.c Tue Jan 14 17:39:12 2020 -0800 +++ b/mercurial/thirdparty/sha1dc/cext.c Tue Jan 14 17:53:43 2020 -0800 @@ -95,7 +95,7 @@ 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;