diff options
Diffstat (limited to 'Modules/md5module.c')
-rw-r--r-- | Modules/md5module.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Modules/md5module.c b/Modules/md5module.c index de43f1c..b6ab5ca 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -376,7 +376,7 @@ MD5_hexdigest(MD5object *self, PyObject *unused) unsigned char digest[MD5_DIGESTSIZE]; struct md5_state temp; PyObject *retval; - Py_UNICODE *hex_digest; + Py_UCS1 *hex_digest; int i, j; /* Get the raw (binary) digest value */ @@ -384,14 +384,10 @@ MD5_hexdigest(MD5object *self, PyObject *unused) md5_done(&temp, digest); /* Create a new string */ - retval = PyUnicode_FromStringAndSize(NULL, MD5_DIGESTSIZE * 2); + retval = PyUnicode_New(MD5_DIGESTSIZE * 2, 127); if (!retval) return NULL; - hex_digest = PyUnicode_AS_UNICODE(retval); - if (!hex_digest) { - Py_DECREF(retval); - return NULL; - } + hex_digest = PyUnicode_1BYTE_DATA(retval); /* Make hex version of the digest */ for(i=j=0; i<MD5_DIGESTSIZE; i++) { |