Merged revisions 55007-55179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

........
  r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines

  Use the new print syntax, at least.
........
  r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line

  remove old cruftiness
........
  r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line

  make this work with the new Python
........
  r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line

  Get asdl code gen working with Python 2.3.  Should continue to work with 3.0
........
  r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line

  Verify checkins to p3yk (sic) branch go to 3000 list.
........
  r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line

  Fix this test so it runs again by importing warnings_test properly.
........
  r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines

  So long xrange.  range() now supports values that are outside
  -sys.maxint to sys.maxint.  floats raise a TypeError.

  This has been sitting for a long time.  It probably has some problems and
  needs cleanup.  Objects/rangeobject.c now uses 4-space indents since
  it is almost completely new.
........
  r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines

  Fix two tests that were previously depending on significant spaces
  at the end of a line (and before that on Python 2.x print behavior
  that has no exact equivalent in 3.0).
........
diff --git a/Tools/pybench/Arithmetic.py b/Tools/pybench/Arithmetic.py
index 6923b4b..6ef2f20 100644
--- a/Tools/pybench/Arithmetic.py
+++ b/Tools/pybench/Arithmetic.py
@@ -8,7 +8,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             a = 2
             b = 3
@@ -152,7 +152,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class SimpleFloatArithmetic(Test):
@@ -163,7 +163,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             a = 2.1
             b = 3.3332
@@ -307,7 +307,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class SimpleIntFloatArithmetic(Test):
@@ -318,7 +318,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             a = 2
             b = 3
@@ -462,7 +462,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -474,7 +474,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             a = 2220001L
             b = 100001L
@@ -618,7 +618,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class SimpleComplexArithmetic(Test):
@@ -629,7 +629,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             a = 2 + 3j
             b = 2.5 + 4.5j
@@ -773,5 +773,5 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Calls.py b/Tools/pybench/Calls.py
index 72ccd0e..cfe0715 100644
--- a/Tools/pybench/Calls.py
+++ b/Tools/pybench/Calls.py
@@ -24,7 +24,7 @@
             return d,e,f
 
         # do calls
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             f()
             f1(i)
@@ -104,7 +104,7 @@
             return d,e,f
 
         # do calls
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 ###
@@ -124,7 +124,7 @@
         f3 = range
 
         # do calls
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             f0()
             f0()
@@ -225,7 +225,7 @@
         f3 = range
 
         # do calls
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 ###
@@ -261,7 +261,7 @@
 
         o = c()
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             o.f()
             o.f()
@@ -367,7 +367,7 @@
 
         o = c
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 ###
@@ -388,7 +388,7 @@
                 return f(x-1)
             return 1
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             f(10)
             f(10)
             f(10)
@@ -405,7 +405,7 @@
                 return f(x-1)
             return 1
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
diff --git a/Tools/pybench/Constructs.py b/Tools/pybench/Constructs.py
index 5105461..7273b87 100644
--- a/Tools/pybench/Constructs.py
+++ b/Tools/pybench/Constructs.py
@@ -9,7 +9,7 @@
     def test(self):
 
         a,b,c = 1,2,3
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             if a == 1:
                 if b == 2:
@@ -464,7 +464,7 @@
     def calibrate(self):
 
         a,b,c = 1,2,3
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class NestedForLoops(Test):
@@ -478,7 +478,7 @@
         l1 = range(1000)
         l2 = range(10)
         l3 = range(5)
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             for i in l1:
                 for j in l2:
                     for k in l3:
@@ -489,7 +489,7 @@
         l1 = range(1000)
         l2 = range(10)
         l3 = range(5)
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class ForLoops(Test):
@@ -501,7 +501,7 @@
     def test(self):
 
         l1 = range(100)
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             for i in l1:
                 pass
             for i in l1:
@@ -560,5 +560,5 @@
     def calibrate(self):
 
         l1 = range(1000)
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Dict.py b/Tools/pybench/Dict.py
index cb039b0..575758b 100644
--- a/Tools/pybench/Dict.py
+++ b/Tools/pybench/Dict.py
@@ -8,7 +8,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             d1 = {}
             d2 = {}
@@ -72,7 +72,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class DictWithStringKeys(Test):
@@ -85,7 +85,7 @@
 
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             d['abc'] = 1
             d['def'] = 2
@@ -161,7 +161,7 @@
 
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class DictWithFloatKeys(Test):
@@ -174,7 +174,7 @@
 
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             d[1.234] = 1
             d[2.345] = 2
@@ -250,7 +250,7 @@
 
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class DictWithIntegerKeys(Test):
@@ -263,7 +263,7 @@
 
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             d[1] = 1
             d[2] = 2
@@ -339,7 +339,7 @@
 
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class SimpleDictManipulation(Test):
@@ -353,7 +353,7 @@
         d = {}
         has_key = lambda key: key in d
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             d[0] = 3
             d[1] = 4
@@ -500,5 +500,5 @@
         d = {}
         has_key = lambda key: key in d
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Exceptions.py b/Tools/pybench/Exceptions.py
index ab0fa0a..c321b2e 100644
--- a/Tools/pybench/Exceptions.py
+++ b/Tools/pybench/Exceptions.py
@@ -10,7 +10,7 @@
 
         error = ValueError
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             try:
                 raise error
             except:
@@ -48,7 +48,7 @@
 
         error = ValueError
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -60,7 +60,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             try:
                 pass
             except:
@@ -687,7 +687,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 ### Test to make Fredrik happy...
diff --git a/Tools/pybench/Imports.py b/Tools/pybench/Imports.py
index afc728b..399ba17 100644
--- a/Tools/pybench/Imports.py
+++ b/Tools/pybench/Imports.py
@@ -12,7 +12,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             import os
             import os
             import os
@@ -45,7 +45,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -57,7 +57,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             import package
             import package
             import package
@@ -90,7 +90,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class SecondSubmoduleImport(Test):
@@ -101,7 +101,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             import package.submodule
             import package.submodule
             import package.submodule
@@ -134,5 +134,5 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Instances.py b/Tools/pybench/Instances.py
index 1dfc82f..0a09b7b 100644
--- a/Tools/pybench/Instances.py
+++ b/Tools/pybench/Instances.py
@@ -26,7 +26,7 @@
                 self.e = b
                 self.f = c
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             o = c()
             o1 = c()
             o2 = c()
@@ -62,5 +62,5 @@
                 self.e = b
                 self.f = c
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Lists.py b/Tools/pybench/Lists.py
index 67760db..aedd352 100644
--- a/Tools/pybench/Lists.py
+++ b/Tools/pybench/Lists.py
@@ -11,7 +11,7 @@
         l = []
         append = l.append
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             append(2)
             append(3)
@@ -127,7 +127,7 @@
         l = []
         append = l.append
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class ListSlicing(Test):
@@ -141,7 +141,7 @@
         n = range(100)
         r = range(25)
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             l = n[:]
 
@@ -160,7 +160,7 @@
         n = range(100)
         r = range(25)
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             for j in r:
                 pass
 
@@ -172,7 +172,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             l = []
 
@@ -291,5 +291,5 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Lookups.py b/Tools/pybench/Lookups.py
index e454a00..5bf9e76 100644
--- a/Tools/pybench/Lookups.py
+++ b/Tools/pybench/Lookups.py
@@ -11,7 +11,7 @@
         class c:
             pass
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             c.__a = 2
             c.__b = 3
@@ -178,7 +178,7 @@
         class c:
             pass
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class NormalClassAttribute(Test):
@@ -192,7 +192,7 @@
         class c:
             pass
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             c.a = 2
             c.b = 3
@@ -364,7 +364,7 @@
         class c:
             pass
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class SpecialInstanceAttribute(Test):
@@ -379,7 +379,7 @@
             pass
         o = c()
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             o.__a__ = 2
             o.__b__ = 3
@@ -552,7 +552,7 @@
             pass
         o = c()
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class NormalInstanceAttribute(Test):
@@ -567,7 +567,7 @@
             pass
         o = c()
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             o.a = 2
             o.b = 3
@@ -740,7 +740,7 @@
             pass
         o = c()
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class BuiltinMethodLookup(Test):
@@ -754,7 +754,7 @@
         l = []
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             l.append
             l.append
@@ -941,5 +941,5 @@
         l = []
         d = {}
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/NewInstances.py b/Tools/pybench/NewInstances.py
index 258beba..9506da4 100644
--- a/Tools/pybench/NewInstances.py
+++ b/Tools/pybench/NewInstances.py
@@ -35,7 +35,7 @@
                 self.e = b
                 self.f = c
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             o = c()
             o1 = c()
             o2 = c()
@@ -71,5 +71,5 @@
                 self.e = b
                 self.f = c
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Numbers.py b/Tools/pybench/Numbers.py
index 10c8940..b0a11f4 100644
--- a/Tools/pybench/Numbers.py
+++ b/Tools/pybench/Numbers.py
@@ -8,7 +8,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             2 < 3
             2 > 3
@@ -192,7 +192,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -204,7 +204,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             2.1 < 3.31
             2.1 > 3.31
@@ -388,7 +388,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -400,7 +400,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             2.1 < 4
             2.1 > 4
@@ -584,7 +584,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -596,7 +596,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             1234567890L < 3456789012345L
             1234567890L > 3456789012345L
@@ -780,5 +780,5 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Strings.py b/Tools/pybench/Strings.py
index dc49df1..2668d6b 100644
--- a/Tools/pybench/Strings.py
+++ b/Tools/pybench/Strings.py
@@ -14,7 +14,7 @@
         s = join(map(str,range(100)))
         t = join(map(str,range(1,101)))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             t + s
             t + s
             t + s
@@ -80,7 +80,7 @@
         s = join(map(str,range(100)))
         t = join(map(str,range(1,101)))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -96,7 +96,7 @@
         s = join(map(str,range(10)))
         t = join(map(str,range(10))) + "abc"
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             t < s
             t > s
             t == s
@@ -162,7 +162,7 @@
         s = join(map(str,range(10)))
         t = join(map(str,range(10))) + "abc"
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -178,7 +178,7 @@
         s = sys.intern(join(map(str,range(10))))
         t = s
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             t == s
             t == s
             t >= s
@@ -244,7 +244,7 @@
         s = sys.intern(join(map(str,range(10))))
         t = s
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -256,7 +256,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             s = 'om'
             s = s + 'xbx'
             s = s + 'xcx'
@@ -319,7 +319,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -333,7 +333,7 @@
 
         s = join(map(str,range(100)))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             s[50:]
             s[:25]
@@ -379,7 +379,7 @@
 
         s = join(map(str,range(100)))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 ### String methods
@@ -399,7 +399,7 @@
             u = join(map(chr,range(100)),'')
             v = join(map(chr,range(256)),'')
 
-            for i in xrange(self.rounds):
+            for i in range(self.rounds):
 
                 s.lower()
                 s.lower()
@@ -456,7 +456,7 @@
             u = join(map(chr,range(100)),'')
             v = join(map(chr,range(256)),'')
 
-            for i in xrange(self.rounds):
+            for i in range(self.rounds):
                 pass
 
     class StringPredicates(Test):
@@ -470,7 +470,7 @@
             data = ('abc', '123', '   ', '\xe4\xf6\xfc', '\xdf'*10)
             len_data = len(data)
 
-            for i in xrange(self.rounds):
+            for i in range(self.rounds):
                 s = data[i % len_data]
 
                 s.isalnum()
@@ -559,5 +559,5 @@
             data = ('abc', '123', '   ', '\xe4\xf6\xfc', '\xdf'*10)
             len_data = len(data)
 
-            for i in xrange(self.rounds):
+            for i in range(self.rounds):
                 s = data[i % len_data]
diff --git a/Tools/pybench/Tuples.py b/Tools/pybench/Tuples.py
index 8e46989..d93802c 100644
--- a/Tools/pybench/Tuples.py
+++ b/Tools/pybench/Tuples.py
@@ -11,7 +11,7 @@
         r = range(25)
         t = tuple(range(100))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             for j in r:
 
@@ -260,7 +260,7 @@
         r = range(25)
         t = tuple(range(100))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             for j in r:
                 pass
 
@@ -272,7 +272,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             t = (1,2,3,4,5,6)
 
@@ -356,5 +356,5 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
diff --git a/Tools/pybench/Unicode.py b/Tools/pybench/Unicode.py
index 153a91e..21e24c0 100644
--- a/Tools/pybench/Unicode.py
+++ b/Tools/pybench/Unicode.py
@@ -18,7 +18,7 @@
         s = unicode(join(map(str,range(100))))
         t = unicode(join(map(str,range(1,101))))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             t + s
             t + s
             t + s
@@ -84,7 +84,7 @@
         s = unicode(join(map(str,range(100))))
         t = unicode(join(map(str,range(1,101))))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -100,7 +100,7 @@
         s = unicode(join(map(str,range(10))))
         t = unicode(join(map(str,range(10))) + "abc")
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             t < s
             t > s
             t == s
@@ -166,7 +166,7 @@
         s = unicode(join(map(str,range(10))))
         t = unicode(join(map(str,range(10))) + "abc")
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -178,7 +178,7 @@
 
     def test(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             s = u'om'
             s = s + u'xbx'
             s = s + u'xcx'
@@ -241,7 +241,7 @@
 
     def calibrate(self):
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 
@@ -255,7 +255,7 @@
 
         s = unicode(join(map(str,range(100))))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             s[50:]
             s[:25]
@@ -301,7 +301,7 @@
 
         s = unicode(join(map(str,range(100))))
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 ### String methods
@@ -319,7 +319,7 @@
         u = join(map(unichr,range(500)),'')
         v = join(map(unichr,range(1000)),'')
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
 
             s.lower()
             s.lower()
@@ -376,7 +376,7 @@
         u = join(map(unichr,range(500)),'')
         v = join(map(unichr,range(1000)),'')
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             pass
 
 class UnicodePredicates(Test):
@@ -390,7 +390,7 @@
         data = (u'abc', u'123', u'   ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
         len_data = len(data)
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             s = data[i % len_data]
 
             s.isalnum()
@@ -448,7 +448,7 @@
         data = (u'abc', u'123', u'   ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
         len_data = len(data)
 
-        for i in xrange(self.rounds):
+        for i in range(self.rounds):
             s = data[i % len_data]
 
 try:
@@ -475,7 +475,7 @@
             mirrored = unicodedata.mirrored
             combining = unicodedata.combining
 
-            for i in xrange(self.rounds):
+            for i in range(self.rounds):
 
                 c = data[i % len_data]
 
@@ -537,6 +537,6 @@
             mirrored = unicodedata.mirrored
             combining = unicodedata.combining
 
-            for i in xrange(self.rounds):
+            for i in range(self.rounds):
 
                 c = data[i % len_data]
diff --git a/Tools/pybench/systimes.py b/Tools/pybench/systimes.py
index bf07e36..5478c28 100644
--- a/Tools/pybench/systimes.py
+++ b/Tools/pybench/systimes.py
@@ -181,7 +181,7 @@
 
 def some_workload():
     x = 0L
-    for i in xrange(10000000L):
+    for i in range(10000000L):
         x = x + 1L
 
 def test_workload():
diff --git a/Tools/scripts/reindent.py b/Tools/scripts/reindent.py
index dade071..13a5f9b 100644
--- a/Tools/scripts/reindent.py
+++ b/Tools/scripts/reindent.py
@@ -193,7 +193,7 @@
                     want = have2want.get(have, -1)
                     if want < 0:
                         # Then it probably belongs to the next real stmt.
-                        for j in xrange(i+1, len(stats)-1):
+                        for j in range(i+1, len(stats)-1):
                             jline, jlevel = stats[j]
                             if jlevel >= 0:
                                 if have == getlspace(lines[jline]):
@@ -203,7 +203,7 @@
                                            # comment like this one,
                         # in which case we should shift it like its base
                         # line got shifted.
-                        for j in xrange(i-1, -1, -1):
+                        for j in range(i-1, -1, -1):
                             jline, jlevel = stats[j]
                             if jlevel >= 0:
                                 want = have + getlspace(after[jline-1]) - \
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py
index 9de6904..2a85e84 100644
--- a/Tools/unicode/makeunicodedata.py
+++ b/Tools/unicode/makeunicodedata.py
@@ -935,7 +935,7 @@
     if __debug__:
         # exhaustively verify that the decomposition is correct
         mask = ~((~0) << shift) # i.e., low-bit mask of shift bits
-        for i in xrange(len(t)):
+        for i in range(len(t)):
             assert t[i] == t2[(t1[i >> shift] << shift) + (i & mask)]
     return best
 
diff --git a/Tools/unicode/mkstringprep.py b/Tools/unicode/mkstringprep.py
index 2525f9e..5be44c9 100644
--- a/Tools/unicode/mkstringprep.py
+++ b/Tools/unicode/mkstringprep.py
@@ -37,7 +37,7 @@
         tuple.append((prev,prev+span+1))
     else:
         single.append(prev)
-    tuple = " + ".join(["range(%d,%d)" % t for t in tuple])
+    tuple = " + ".join(["list(range(%d,%d))" % t for t in tuple])
     if not single:
         return "set(%s)" % tuple
     if not tuple: