diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:24:06 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:24:06 +0000 |
commit | 3241c3649e96c7aaf63db8093035208dab3b7e13 (patch) | |
tree | 7962c3440a66384f4de700c9e22ac74e9d273945 /utils | |
parent | 08e6d377b981edb4779bd3b24fc75335ba42a308 (diff) |
Portable Python script across Python version
Replace `xrange(...)` by either `range(...)` or `list(range(...))` depending on the context.
Differential Revision: https://reviews.llvm.org/D55193
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ABITest/Enumeration.py | 2 | ||||
-rw-r--r-- | utils/ABITest/TypeGen.py | 2 | ||||
-rw-r--r-- | utils/modfuzz.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/utils/ABITest/Enumeration.py b/utils/ABITest/Enumeration.py index 01830a38cd..29a81b4f13 100644 --- a/utils/ABITest/Enumeration.py +++ b/utils/ABITest/Enumeration.py @@ -199,7 +199,7 @@ def getNthPairVariableBounds(N, bounds): raise ValueError("Invalid input (out of bounds)") level = 0 - active = range(len(bounds)) + active = list(range(len(bounds))) active.sort(key=lambda i: bounds[i]) prevLevel = 0 for i,index in enumerate(active): diff --git a/utils/ABITest/TypeGen.py b/utils/ABITest/TypeGen.py index 8330340cd3..f8a4d07e11 100644 --- a/utils/ABITest/TypeGen.py +++ b/utils/ABITest/TypeGen.py @@ -242,7 +242,7 @@ def combinations(values, k): # combinations, selections of a sequence if k==0: yield [] else: - for i in xrange(len(values)-k+1): + for i in range(len(values)-k+1): for cc in combinations(values[i+1:],k-1): yield [values[i]]+cc diff --git a/utils/modfuzz.py b/utils/modfuzz.py index 885621d14e..948603338c 100644 --- a/utils/modfuzz.py +++ b/utils/modfuzz.py @@ -106,7 +106,7 @@ def generate(): try: while True: assert m, 'got a failure with no steps; broken clang binary?' - i = random.choice(range(len(m))) + i = random.choice(list(range(len(m)))) x = m[0:i] + m[i+1:] m2 = CodeModel() for d in x: |