Fix usages of range() and xrange() for Python 3.
llvm-svn: 251302
diff --git a/lldb/test/example/TestSequenceFunctions.py b/lldb/test/example/TestSequenceFunctions.py
index f4f3d01..a085293 100644
--- a/lldb/test/example/TestSequenceFunctions.py
+++ b/lldb/test/example/TestSequenceFunctions.py
@@ -8,7 +8,7 @@
def setUp(self):
#traceback.print_stack()
- self.seq = range(10)
+ self.seq = list(range(10))
def tearDown(self):
#traceback.print_stack()
@@ -18,7 +18,7 @@
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.seq)
self.seq.sort()
- self.assertEqual(self.seq, range(10))
+ self.assertEqual(self.seq, list(range(10)))
def test_choice(self):
element = random.choice(self.seq)
diff --git a/lldb/test/functionalities/inferior-assert/TestInferiorAssert.py b/lldb/test/functionalities/inferior-assert/TestInferiorAssert.py
index 2bf1108..ccf4d61 100644
--- a/lldb/test/functionalities/inferior-assert/TestInferiorAssert.py
+++ b/lldb/test/functionalities/inferior-assert/TestInferiorAssert.py
@@ -20,7 +20,7 @@
self.inferior_asserting()
@expectedFailureWindows("llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
- @expectedFailureAndroid(api_levels=range(16 + 1)) # b.android.com/179836
+ @expectedFailureAndroid(api_levels=list(range(16 + 1))) # b.android.com/179836
def test_inferior_asserting_register(self):
"""Test that lldb reliably reads registers from the inferior after asserting (command)."""
self.build()
@@ -58,7 +58,7 @@
lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
def check_stop_reason(self):
- if matchAndroid(api_levels=range(1, 16+1))(self):
+ if matchAndroid(api_levels=list(range(1, 16+1)))(self):
# On android until API-16 the abort() call ended in a sigsegv instead of in a sigabrt
stop_reason = 'stop reason = signal SIGSEGV'
else:
diff --git a/lldb/test/functionalities/inferior-crashing/TestInferiorCrashing.py b/lldb/test/functionalities/inferior-crashing/TestInferiorCrashing.py
index 3e79c77..ad908f9 100644
--- a/lldb/test/functionalities/inferior-crashing/TestInferiorCrashing.py
+++ b/lldb/test/functionalities/inferior-crashing/TestInferiorCrashing.py
@@ -47,7 +47,7 @@
@expectedFailureFreeBSD('llvm.org/pr24939')
@expectedFailureWindows("llvm.org/pr24778")
- @expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No eh_frame for sa_restorer
+ @expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) # No eh_frame for sa_restorer
def test_inferior_crashing_step_after_break(self):
"""Test that lldb functions correctly after stepping through a crash."""
self.build()
diff --git a/lldb/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py b/lldb/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
index efc857d..05af075 100644
--- a/lldb/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
+++ b/lldb/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
@@ -47,7 +47,7 @@
@expectedFailureFreeBSD('llvm.org/pr24939')
@expectedFailureWindows("llvm.org/pr24778")
- @expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No eh_frame for sa_restorer
+ @expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) # No eh_frame for sa_restorer
def test_recursive_inferior_crashing_step_after_break(self):
"""Test that lldb functions correctly after stepping through a crash."""
self.build()
diff --git a/lldb/test/lang/go/goroutines/TestGoroutines.py b/lldb/test/lang/go/goroutines/TestGoroutines.py
index a51ad7b..b3cfb76 100644
--- a/lldb/test/lang/go/goroutines/TestGoroutines.py
+++ b/lldb/test/lang/go/goroutines/TestGoroutines.py
@@ -75,7 +75,7 @@
# self.dbg.HandleCommand("log enable lldb os")
# Now test that stepping works if the memory thread moves to a different backing thread.
- for i in xrange(11):
+ for i in list(range(11)):
self.thread().StepOver()
self.assertEqual(lldb.eStopReasonPlanComplete, self.thread().GetStopReason(), self.thread().GetStopDescription(100))
diff --git a/lldb/test/lang/go/types/TestGoASTContext.py b/lldb/test/lang/go/types/TestGoASTContext.py
index 4c1e451..ac4534a 100644
--- a/lldb/test/lang/go/types/TestGoASTContext.py
+++ b/lldb/test/lang/go/types/TestGoASTContext.py
@@ -129,5 +129,5 @@
v = self.var('theArray')
self.assertEqual(5, v.GetNumChildren())
- for i in xrange(5):
+ for i in list(range(5)):
self.assertEqual(str(i + 1), v.GetChildAtIndex(i).value)
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py
index c824990..f51d6e2 100644
--- a/lldb/test/lldbutil.py
+++ b/lldb/test/lldbutil.py
@@ -607,7 +607,7 @@
def GetFuncName(i):
return thread.GetFrameAtIndex(i).GetFunctionName()
- return list(map(GetFuncName, range(thread.GetNumFrames())))
+ return list(map(GetFuncName, list(range(thread.GetNumFrames()))))
def get_symbol_names(thread):
@@ -617,7 +617,7 @@
def GetSymbol(i):
return thread.GetFrameAtIndex(i).GetSymbol().GetName()
- return list(map(GetSymbol, range(thread.GetNumFrames())))
+ return list(map(GetSymbol, list(range(thread.GetNumFrames()))))
def get_pc_addresses(thread):
@@ -627,7 +627,7 @@
def GetPCAddress(i):
return thread.GetFrameAtIndex(i).GetPCAddress()
- return list(map(GetPCAddress, range(thread.GetNumFrames())))
+ return list(map(GetPCAddress, list(range(thread.GetNumFrames()))))
def get_filenames(thread):
@@ -637,7 +637,7 @@
def GetFilename(i):
return thread.GetFrameAtIndex(i).GetLineEntry().GetFileSpec().GetFilename()
- return list(map(GetFilename, range(thread.GetNumFrames())))
+ return list(map(GetFilename, list(range(thread.GetNumFrames()))))
def get_line_numbers(thread):
@@ -647,7 +647,7 @@
def GetLineNumber(i):
return thread.GetFrameAtIndex(i).GetLineEntry().GetLine()
- return list(map(GetLineNumber, range(thread.GetNumFrames())))
+ return list(map(GetLineNumber, list(range(thread.GetNumFrames()))))
def get_module_names(thread):
@@ -657,7 +657,7 @@
def GetModuleName(i):
return thread.GetFrameAtIndex(i).GetModule().GetFileSpec().GetFilename()
- return list(map(GetModuleName, range(thread.GetNumFrames())))
+ return list(map(GetModuleName, list(range(thread.GetNumFrames()))))
def get_stack_frames(thread):
@@ -667,7 +667,7 @@
def GetStackFrame(i):
return thread.GetFrameAtIndex(i)
- return list(map(GetStackFrame, range(thread.GetNumFrames())))
+ return list(map(GetStackFrame, list(range(thread.GetNumFrames()))))
def print_stacktrace(thread, string_buffer = False):
diff --git a/lldb/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py b/lldb/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
index b8a970a..0e1bf1b 100644
--- a/lldb/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
+++ b/lldb/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
@@ -34,7 +34,7 @@
@llgs_test
# std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
- @expectedFailureAndroid(api_levels=range(16 + 1))
+ @expectedFailureAndroid(api_levels=list(range(16 + 1)))
def test_inferior_abort_received_llgs(self):
self.init_llgs_test()
self.build()