[Lldb-commits] [lldb] r251302 - Fix usages of range() and xrange() for Python 3.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 26 09:49:57 PDT 2015


Author: zturner
Date: Mon Oct 26 11:49:57 2015
New Revision: 251302

URL: http://llvm.org/viewvc/llvm-project?rev=251302&view=rev
Log:
Fix usages of range() and xrange() for Python 3.

Modified:
    lldb/trunk/test/example/TestSequenceFunctions.py
    lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
    lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
    lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
    lldb/trunk/test/lang/go/goroutines/TestGoroutines.py
    lldb/trunk/test/lang/go/types/TestGoASTContext.py
    lldb/trunk/test/lldbutil.py
    lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py

Modified: lldb/trunk/test/example/TestSequenceFunctions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/example/TestSequenceFunctions.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/example/TestSequenceFunctions.py (original)
+++ lldb/trunk/test/example/TestSequenceFunctions.py Mon Oct 26 11:49:57 2015
@@ -8,7 +8,7 @@ class SequenceFunctionsTestCase(unittest
 
     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 @@ class SequenceFunctionsTestCase(unittest
         # 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)

Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py (original)
+++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Mon Oct 26 11:49:57 2015
@@ -20,7 +20,7 @@ class AssertingInferiorTestCase(TestBase
         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 @@ class AssertingInferiorTestCase(TestBase
         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:

Modified: lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py (original)
+++ lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py Mon Oct 26 11:49:57 2015
@@ -47,7 +47,7 @@ class CrashingInferiorTestCase(TestBase)
 
     @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()

Modified: lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py (original)
+++ lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py Mon Oct 26 11:49:57 2015
@@ -47,7 +47,7 @@ class CrashingRecursiveInferiorTestCase(
 
     @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()

Modified: lldb/trunk/test/lang/go/goroutines/TestGoroutines.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/go/goroutines/TestGoroutines.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/lang/go/goroutines/TestGoroutines.py (original)
+++ lldb/trunk/test/lang/go/goroutines/TestGoroutines.py Mon Oct 26 11:49:57 2015
@@ -75,7 +75,7 @@ class TestGoASTContext(TestBase):
         # 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))
         

Modified: lldb/trunk/test/lang/go/types/TestGoASTContext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/go/types/TestGoASTContext.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/lang/go/types/TestGoASTContext.py (original)
+++ lldb/trunk/test/lang/go/types/TestGoASTContext.py Mon Oct 26 11:49:57 2015
@@ -129,5 +129,5 @@ class TestGoASTContext(TestBase):
 
         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)

Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Mon Oct 26 11:49:57 2015
@@ -607,7 +607,7 @@ def get_function_names(thread):
     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 get_symbol_names(thread):
     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 get_pc_addresses(thread):
     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 get_filenames(thread):
     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 get_line_numbers(thread):
     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 get_module_names(thread):
     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 get_stack_frames(thread):
     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):

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py?rev=251302&r1=251301&r2=251302&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py (original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py Mon Oct 26 11:49:57 2015
@@ -34,7 +34,7 @@ class TestGdbRemoteAbort(gdbremote_testc
 
     @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()




More information about the lldb-commits mailing list