diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-02-07 17:13:31 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-02-07 17:13:31 (GMT) |
commit | 8a68122e9cb1ecd0ade79052ac66ad35c6333270 (patch) | |
tree | 1c5bfc6cfd2d2b6208fabcb72453cc34968116a0 /Tools/pybench/Strings.py | |
parent | 7bf8d4ed4da5555dcf72652926bfb29276f7a6bc (diff) | |
download | cpython-8a68122e9cb1ecd0ade79052ac66ad35c6333270.zip cpython-8a68122e9cb1ecd0ade79052ac66ad35c6333270.tar.gz cpython-8a68122e9cb1ecd0ade79052ac66ad35c6333270.tar.bz2 |
Issue #4704: remove use of cmp() in pybench, bump its version number to 2.1,
and make it 2.6-compatible.
Diffstat (limited to 'Tools/pybench/Strings.py')
-rw-r--r-- | Tools/pybench/Strings.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Tools/pybench/Strings.py b/Tools/pybench/Strings.py index 25e2ad5..8e3d702 100644 --- a/Tools/pybench/Strings.py +++ b/Tools/pybench/Strings.py @@ -1,6 +1,12 @@ from pybench import Test import sys +try: + intern +except NameError: + intern = sys.intern + + class ConcatStrings(Test): version = 2.0 @@ -174,7 +180,7 @@ class CompareInternedStrings(Test): def test(self): # Make sure the strings *are* interned - s = sys.intern(''.join(map(str,range(10)))) + s = intern(''.join(map(str,range(10)))) t = s for i in range(self.rounds): @@ -240,7 +246,7 @@ class CompareInternedStrings(Test): def calibrate(self): - s = sys.intern(''.join(map(str,range(10)))) + s = intern(''.join(map(str,range(10)))) t = s for i in range(self.rounds): |