From: Neal Norwitz Date: Sat, 25 Aug 2007 08:01:41 +0000 (+0000) Subject: Use unicode X-Git-Tag: v3.0a1~265 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4e2f76d240a5a03d65d6e14f0c868c3bc805fb9;p=python Use unicode --- diff --git a/Modules/sha256module.c b/Modules/sha256module.c index 5b49c9f4d5..27c4b19b9c 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -444,7 +444,7 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused) unsigned char digest[SHA_DIGESTSIZE]; SHAobject temp; PyObject *retval; - char *hex_digest; + Py_UNICODE *hex_digest; int i, j; /* Get the raw (binary) digest value */ @@ -452,10 +452,10 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused) sha_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyUnicode_AS_UNICODE(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; diff --git a/Modules/sha512module.c b/Modules/sha512module.c index 5eedb4cd68..1d3a70b9df 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -510,7 +510,7 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused) unsigned char digest[SHA_DIGESTSIZE]; SHAobject temp; PyObject *retval; - char *hex_digest; + Py_UNICODE *hex_digest; int i, j; /* Get the raw (binary) digest value */ @@ -518,10 +518,10 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused) sha512_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyUnicode_AS_UNICODE(retval); if (!hex_digest) { Py_DECREF(retval); return NULL;