More 2to3 fixes in the Tools directory. Fixes #2893.
diff --git a/Tools/pybench/CommandLine.py b/Tools/pybench/CommandLine.py
index d0142f8..d6ef0be 100644
--- a/Tools/pybench/CommandLine.py
+++ b/Tools/pybench/CommandLine.py
@@ -537,9 +537,9 @@
if not options:
print(' None')
return
- long = filter(lambda x: x.prefix == '--', options)
- short = filter(lambda x: x.prefix == '-', options)
- items = short + long
+ int = [x for x in options if x.prefix == '--']
+ short = [x for x in options if x.prefix == '-']
+ items = short + int
for o in options:
print(' ',o)
print()
diff --git a/Tools/pybench/Lists.py b/Tools/pybench/Lists.py
index 9aeb408..c39687e 100644
--- a/Tools/pybench/Lists.py
+++ b/Tools/pybench/Lists.py
@@ -157,8 +157,8 @@
def calibrate(self):
- n = range(100)
- r = range(25)
+ n = list(range(100))
+ r = list(range(25))
for i in range(self.rounds):
for j in r:
diff --git a/Tools/pybench/With.py b/Tools/pybench/With.py
index 3af24cc..5f59e8c 100644
--- a/Tools/pybench/With.py
+++ b/Tools/pybench/With.py
@@ -17,7 +17,7 @@
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
with cm: pass
with cm: pass
with cm: pass
@@ -43,7 +43,7 @@
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
pass
@@ -65,7 +65,7 @@
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
cm.__enter__()
try: pass
finally: cm.__exit__()
@@ -150,7 +150,7 @@
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
pass
@@ -171,12 +171,12 @@
error = ValueError
be = self.BlockExceptions()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
with be: raise error
with be: raise error
- with be: raise error,"something"
- with be: raise error,"something"
- with be: raise error,"something"
+ with be: raise error("something")
+ with be: raise error("something")
+ with be: raise error("something")
with be: raise error("something")
with be: raise error("something")
with be: raise error("something")
@@ -186,5 +186,5 @@
error = ValueError
be = self.BlockExceptions()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
pass
diff --git a/Tools/pybench/clockres.py b/Tools/pybench/clockres.py
index 42f5ee7..d7f1ac8 100644
--- a/Tools/pybench/clockres.py
+++ b/Tools/pybench/clockres.py
@@ -23,8 +23,7 @@
break
for i in spin_loops:
d[timer()] = 1
- values = d.keys()
- values.sort()
+ values = sorted(d.keys())
min_diff = TEST_TIME
for i in range(len(values) - 1):
diff = values[i+1] - values[i]
diff --git a/Tools/pybench/pybench.py b/Tools/pybench/pybench.py
index 781b4f8..771d7ac 100755
--- a/Tools/pybench/pybench.py
+++ b/Tools/pybench/pybench.py
@@ -107,15 +107,13 @@
buildno, builddate = platform.python_build()
python = platform.python_version()
try:
- unichr(100000)
+ chr(100000)
except ValueError:
# UCS2 build (standard)
- unicode = 'UCS2'
- except NameError:
- unicode = None
+ unitype = 'UCS2'
else:
# UCS4 build (most recent Linux distros)
- unicode = 'UCS4'
+ unitype = 'UCS4'
bits, linkage = platform.architecture()
return {
'platform': platform.platform(),
@@ -127,7 +125,7 @@
'compiler': platform.python_compiler(),
'buildno': buildno,
'builddate': builddate,
- 'unicode': unicode,
+ 'unicode': unitype,
'bits': bits,
}