[Python-3000-checkins] r57459 - python/branches/py3k/Modules/sha256module.c python/branches/py3k/Modules/sha512module.c

neal.norwitz python-3000-checkins at python.org
Sat Aug 25 10:01:41 CEST 2007


Author: neal.norwitz
Date: Sat Aug 25 10:01:41 2007
New Revision: 57459

Modified:
   python/branches/py3k/Modules/sha256module.c
   python/branches/py3k/Modules/sha512module.c
Log:
Use unicode

Modified: python/branches/py3k/Modules/sha256module.c
==============================================================================
--- python/branches/py3k/Modules/sha256module.c	(original)
+++ python/branches/py3k/Modules/sha256module.c	Sat Aug 25 10:01:41 2007
@@ -444,7 +444,7 @@
     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 @@
     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;

Modified: python/branches/py3k/Modules/sha512module.c
==============================================================================
--- python/branches/py3k/Modules/sha512module.c	(original)
+++ python/branches/py3k/Modules/sha512module.c	Sat Aug 25 10:01:41 2007
@@ -510,7 +510,7 @@
     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_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;


More information about the Python-3000-checkins mailing list