diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-09-28 07:41:54 +0200 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-09-28 07:41:54 +0200 |
commit | d63a3b8beb4a0841cb59fb3515347ccaab34b733 (patch) | |
tree | 3b4e3cc63151c5a5a910c3550a190aefaea96ad4 /Modules/md5module.c | |
parent | 48d49497c50e79d14e9df9527d766ca3a0a38be5 (diff) | |
download | cpython-git-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.gz |
Implement PEP 393.
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 de43f1cc7b..b6ab5ca302 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++) { |