diff setup.py @ 76999:0a1d7be10946

Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 16 May 2012 16:41:26 +0200
parents f3a27d11101a
children 294f8aeb4d4b
line wrap: on
line diff
--- a/setup.py	Wed May 16 16:03:07 2012 +0200
+++ b/setup.py	Wed May 16 16:41:26 2012 +0200
@@ -749,20 +749,17 @@
                       openssl_ver)
                 missing.append('_hashlib')
 
-        min_sha2_openssl_ver = 0x00908000
-        if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver:
-            # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
-            exts.append( Extension('_sha256', ['sha256module.c'],
-                                   depends=['hashlib.h']) )
-            exts.append( Extension('_sha512', ['sha512module.c'],
-                                   depends=['hashlib.h']) )
-
-        if COMPILED_WITH_PYDEBUG or not have_usable_openssl:
-            # no openssl at all, use our own md5 and sha1
-            exts.append( Extension('_md5', ['md5module.c'],
-                                   depends=['hashlib.h']) )
-            exts.append( Extension('_sha1', ['sha1module.c'],
-                                   depends=['hashlib.h']) )
+        # We always compile these even when OpenSSL is available (issue #14693).
+        # It's harmless and the object code is tiny (40-50 KB per module,
+        # only loaded when actually used).
+        exts.append( Extension('_sha256', ['sha256module.c'],
+                               depends=['hashlib.h']) )
+        exts.append( Extension('_sha512', ['sha512module.c'],
+                               depends=['hashlib.h']) )
+        exts.append( Extension('_md5', ['md5module.c'],
+                               depends=['hashlib.h']) )
+        exts.append( Extension('_sha1', ['sha1module.c'],
+                               depends=['hashlib.h']) )
 
         # Modules that provide persistent dictionary-like semantics.  You will
         # probably want to arrange for at least one of them to be available on