diff options
author | Georg Brandl <georg@python.org> | 2006-09-06 06:51:57 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-09-06 06:51:57 (GMT) |
commit | 7cae87ca7b0a3a7ce497cbd335c8ec82fe680476 (patch) | |
tree | 612cc46e728bef49b19f3d4bc26fa4951b2c1c83 /Lib/test/time_hashlib.py | |
parent | 4e472e05bdddde72d91d6f25d6e048371cf3c9be (diff) | |
download | cpython-7cae87ca7b0a3a7ce497cbd335c8ec82fe680476.zip cpython-7cae87ca7b0a3a7ce497cbd335c8ec82fe680476.tar.gz cpython-7cae87ca7b0a3a7ce497cbd335c8ec82fe680476.tar.bz2 |
Patch #1550800: make exec a function.
Diffstat (limited to 'Lib/test/time_hashlib.py')
-rw-r--r-- | Lib/test/time_hashlib.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/time_hashlib.py b/Lib/test/time_hashlib.py index 1bf707d..de25cfd 100644 --- a/Lib/test/time_hashlib.py +++ b/Lib/test/time_hashlib.py @@ -44,22 +44,22 @@ hName = sys.argv[1] # setup our creatorFunc to test the requested hash # if hName in ('_md5', '_sha'): - exec 'import '+hName - exec 'creatorFunc = '+hName+'.new' + exec('import '+hName) + exec('creatorFunc = '+hName+'.new') print "testing speed of old", hName, "legacy interface" elif hName == '_hashlib' and len(sys.argv) > 3: import _hashlib - exec 'creatorFunc = _hashlib.%s' % sys.argv[2] + exec('creatorFunc = _hashlib.%s' % sys.argv[2]) print "testing speed of _hashlib.%s" % sys.argv[2], getattr(_hashlib, sys.argv[2]) elif hName == '_hashlib' and len(sys.argv) == 3: import _hashlib - exec 'creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2] + exec('creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2]) print "testing speed of _hashlib.new(%r)" % sys.argv[2] elif hasattr(hashlib, hName) and callable(getattr(hashlib, hName)): creatorFunc = getattr(hashlib, hName) print "testing speed of hashlib."+hName, getattr(hashlib, hName) else: - exec "creatorFunc = lambda x=hashlib.new : x(%r)" % hName + exec("creatorFunc = lambda x=hashlib.new : x(%r)" % hName) print "testing speed of hashlib.new(%r)" % hName try: |