summaryrefslogtreecommitdiffstats
path: root/Modules/sha512module.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
commitd63a3b8beb4a0841cb59fb3515347ccaab34b733 (patch)
tree3b4e3cc63151c5a5a910c3550a190aefaea96ad4 /Modules/sha512module.c
parent48d49497c50e79d14e9df9527d766ca3a0a38be5 (diff)
downloadcpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.zip
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.gz
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.bz2
Implement PEP 393.
Diffstat (limited to 'Modules/sha512module.c')
-rw-r--r--Modules/sha512module.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index 0faaf5c..4177000 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -511,7 +511,7 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
PyObject *retval;
- Py_UNICODE *hex_digest;
+ Py_UCS1 *hex_digest;
int i, j;
/* Get the raw (binary) digest value */
@@ -519,14 +519,10 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
sha512_final(digest, &temp);
/* Create a new string */
- retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2);
+ retval = PyUnicode_New(self->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<self->digestsize; i++) {