[Python-3000-checkins] r58847 - python/branches/py3k-pep3137/Modules/md5module.c python/branches/py3k-pep3137/Modules/sha1module.c python/branches/py3k-pep3137/Modules/sha256module.c python/branches/py3k-pep3137/Modules/sha512module.c

christian.heimes python-3000-checkins at python.org
Mon Nov 5 00:08:37 CET 2007


Author: christian.heimes
Date: Mon Nov  5 00:08:37 2007
New Revision: 58847

Modified:
   python/branches/py3k-pep3137/Modules/md5module.c
   python/branches/py3k-pep3137/Modules/sha1module.c
   python/branches/py3k-pep3137/Modules/sha256module.c
   python/branches/py3k-pep3137/Modules/sha512module.c
Log:
Patch #1387 from Amaury Forgeot d'Arc

On Windows, openssl is not always available, in this case python uses
its own implementation of md5, sha1 &co.
This patch correct the failing tests (test_hashlib and test_uuid), by
returning bytes instead of buffers.


Modified: python/branches/py3k-pep3137/Modules/md5module.c
==============================================================================
--- python/branches/py3k-pep3137/Modules/md5module.c	(original)
+++ python/branches/py3k-pep3137/Modules/md5module.c	Mon Nov  5 00:08:37 2007
@@ -363,7 +363,7 @@
 
     temp = self->hash_state;
     md5_done(&temp, digest);
-    return PyBytes_FromStringAndSize((const char *)digest, MD5_DIGESTSIZE);
+    return PyString_FromStringAndSize((const char *)digest, MD5_DIGESTSIZE);
 }
 
 PyDoc_STRVAR(MD5_hexdigest__doc__,

Modified: python/branches/py3k-pep3137/Modules/sha1module.c
==============================================================================
--- python/branches/py3k-pep3137/Modules/sha1module.c	(original)
+++ python/branches/py3k-pep3137/Modules/sha1module.c	Mon Nov  5 00:08:37 2007
@@ -339,7 +339,7 @@
 
     temp = self->hash_state;
     sha1_done(&temp, digest);
-    return PyBytes_FromStringAndSize((const char *)digest, SHA1_DIGESTSIZE);
+    return PyString_FromStringAndSize((const char *)digest, SHA1_DIGESTSIZE);
 }
 
 PyDoc_STRVAR(SHA1_hexdigest__doc__,

Modified: python/branches/py3k-pep3137/Modules/sha256module.c
==============================================================================
--- python/branches/py3k-pep3137/Modules/sha256module.c	(original)
+++ python/branches/py3k-pep3137/Modules/sha256module.c	Mon Nov  5 00:08:37 2007
@@ -432,7 +432,7 @@
 
     SHAcopy(self, &temp);
     sha_final(digest, &temp);
-    return PyBytes_FromStringAndSize((const char *)digest, self->digestsize);
+    return PyString_FromStringAndSize((const char *)digest, self->digestsize);
 }
 
 PyDoc_STRVAR(SHA256_hexdigest__doc__,

Modified: python/branches/py3k-pep3137/Modules/sha512module.c
==============================================================================
--- python/branches/py3k-pep3137/Modules/sha512module.c	(original)
+++ python/branches/py3k-pep3137/Modules/sha512module.c	Mon Nov  5 00:08:37 2007
@@ -498,7 +498,7 @@
 
     SHAcopy(self, &temp);
     sha512_final(digest, &temp);
-    return PyBytes_FromStringAndSize((const char *)digest, self->digestsize);
+    return PyString_FromStringAndSize((const char *)digest, self->digestsize);
 }
 
 PyDoc_STRVAR(SHA512_hexdigest__doc__,


More information about the Python-3000-checkins mailing list