cpython: 0a1d7be10946 (original) (raw)
Mercurial > cpython
changeset 76999:0a1d7be10946
Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time. [#14693]
Antoine Pitrou solipsis@pitrou.net | |
---|---|
date | Wed, 16 May 2012 16:41:26 +0200 |
parents | 828be43434e8 |
children | 0f6a6f59b002 |
files | Lib/test/test_hashlib.py Misc/NEWS setup.py |
diffstat | 3 files changed, 17 insertions(+), 15 deletions(-)[+] [-] Lib/test/test_hashlib.py 4 Misc/NEWS 3 setup.py 25 |
line wrap: on
line diff
--- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -9,6 +9,7 @@ import array import hashlib import itertools +import os import sys try: import threading @@ -37,7 +38,8 @@ class HashLibTestCase(unittest.TestCase) 'sha224', 'SHA224', 'sha256', 'SHA256', 'sha384', 'SHA384', 'sha512', 'SHA512' )
Issue #14693: fallback modules are always compiled under POSIX
- _warn_on_extension_import = os.name == 'posix' or COMPILED_WITH_PYDEBUG
def _conditional_import_module(self, module_name): """Import a module and return a reference to it or None on failure."""
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -125,6 +125,9 @@ Tools/Demos Build ----- +- Issue #14693: Under non-Windows platforms, hashlib's fallback modules are
--- a/setup.py +++ b/setup.py @@ -749,20 +749,17 @@ class PyBuildExt(build_ext): openssl_ver) missing.append('_hashlib')
min_sha2_openssl_ver = 0x00908000[](#l3.7)
if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver:[](#l3.8)
# OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash[](#l3.9)
exts.append( Extension('_sha256', ['sha256module.c'],[](#l3.10)
depends=['hashlib.h']) )[](#l3.11)
exts.append( Extension('_sha512', ['sha512module.c'],[](#l3.12)
depends=['hashlib.h']) )[](#l3.13)
if COMPILED_WITH_PYDEBUG or not have_usable_openssl:[](#l3.15)
# no openssl at all, use our own md5 and sha1[](#l3.16)
exts.append( Extension('_md5', ['md5module.c'],[](#l3.17)
depends=['hashlib.h']) )[](#l3.18)
exts.append( Extension('_sha1', ['sha1module.c'],[](#l3.19)
depends=['hashlib.h']) )[](#l3.20)
# We always compile these even when OpenSSL is available (issue #14693).[](#l3.21)
# It's harmless and the object code is tiny (40-50 KB per module,[](#l3.22)
# only loaded when actually used).[](#l3.23)
exts.append( Extension('_sha256', ['sha256module.c'],[](#l3.24)
depends=['hashlib.h']) )[](#l3.25)
exts.append( Extension('_sha512', ['sha512module.c'],[](#l3.26)
depends=['hashlib.h']) )[](#l3.27)
exts.append( Extension('_md5', ['md5module.c'],[](#l3.28)
depends=['hashlib.h']) )[](#l3.29)
exts.append( Extension('_sha1', ['sha1module.c'],[](#l3.30)
depends=['hashlib.h']) )[](#l3.31)
# Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on