[Python-checkins] r77259 - in python/branches/py3k: Lib/test/test_hashlib.py setup.py
gregory.p.smith
python-checkins at python.org
Sun Jan 3 01:38:10 CET 2010
Author: gregory.p.smith
Date: Sun Jan 3 01:38:10 2010
New Revision: 77259
Log:
Also fixes test_hashlib for the different extension module names in py3k.
Merged revisions 77251 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77251 | gregory.p.smith | 2010-01-02 14:25:29 -0800 (Sat, 02 Jan 2010) | 6 lines
Always compile the all versions of the hashlib algorithm modules when Python
was compiled with Py_DEBUG defined. Otherwise the builtins are not compiled by
default for many developers due to OpenSSL being present, making it easier for
bugs to slip by. A future commit will add test code compare the behaviors of
all implementations when they are all available.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/test_hashlib.py
python/branches/py3k/setup.py
Modified: python/branches/py3k/Lib/test/test_hashlib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_hashlib.py (original)
+++ python/branches/py3k/Lib/test/test_hashlib.py Sun Jan 3 01:38:10 2010
@@ -78,10 +78,10 @@
_md5 = self._conditional_import_module('_md5')
if _md5:
- self.constructors_to_test['md5'].add(_md5.new)
- _sha = self._conditional_import_module('_sha')
- if _sha:
- self.constructors_to_test['sha1'].add(_sha.new)
+ self.constructors_to_test['md5'].add(_md5.md5)
+ _sha1 = self._conditional_import_module('_sha1')
+ if _sha1:
+ self.constructors_to_test['sha1'].add(_sha1.sha1)
_sha256 = self._conditional_import_module('_sha256')
if _sha256:
self.constructors_to_test['sha224'].add(_sha256.sha224)
Modified: python/branches/py3k/setup.py
==============================================================================
--- python/branches/py3k/setup.py (original)
+++ python/branches/py3k/setup.py Sun Jan 3 01:38:10 2010
@@ -15,6 +15,9 @@
from distutils.command.install import install
from distutils.command.install_lib import install_lib
+# Were we compiled --with-pydebug or with #define Py_DEBUG?
+COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
+
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []
@@ -593,9 +596,13 @@
break
#print('openssl_ver = 0x%08x' % openssl_ver)
+ min_openssl_ver = 0x00907000
+ have_any_openssl = ssl_incs is not None and ssl_libs is not None
+ have_usable_openssl = (have_any_openssl and
+ openssl_ver >= min_openssl_ver)
- if ssl_incs is not None and ssl_libs is not None:
- if openssl_ver >= 0x00907000:
+ if have_any_openssl:
+ if have_usable_openssl:
# The _hashlib module wraps optimized implementations
# of hash functions from the OpenSSL library.
exts.append( Extension('_hashlib', ['_hashopenssl.c'],
@@ -606,15 +613,14 @@
print("warning: openssl 0x%08x is too old for _hashlib" %
openssl_ver)
missing.append('_hashlib')
- else:
- missing.append('_hashlib')
- if openssl_ver < 0x00908000:
+ 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']) )
exts.append( Extension('_sha512', ['sha512module.c']) )
- if openssl_ver < 0x00907000:
+ if COMPILED_WITH_PYDEBUG or openssl_ver < min_openssl_ver:
# no openssl at all, use our own md5 and sha1
exts.append( Extension('_md5', ['md5module.c']) )
exts.append( Extension('_sha1', ['sha1module.c']) )
More information about the Python-checkins
mailing list