From 1c4059a0c430881111c0b2c51cf98fc7fb559eec Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 22 Oct 2015 20:39:59 +0000 Subject: [PATCH] Python 3 porting - Wrap returns from map() in list() Under Python 2 this has no effect, since map() returns a list. In Python 3 map() returns an iterable, so wrapping in a list is necessary to keep the same semantics. llvm-svn: 251060 --- lldb/test/dosep.py | 2 +- lldb/test/dotest.py | 2 +- lldb/test/lldbtest.py | 2 +- lldb/test/lldbutil.py | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lldb/test/dosep.py b/lldb/test/dosep.py index f4133363fb60..7f276e09bb9b 100755 --- a/lldb/test/dosep.py +++ b/lldb/test/dosep.py @@ -921,7 +921,7 @@ def inprocess_exec_test_runner(test_work_items): socket_thread.start() # Do the work. - test_results = map(process_dir_mapper_inprocess, test_work_items) + test_results = list(map(process_dir_mapper_inprocess, test_work_items)) # If we have a listener channel, shut it down here. if RESULTS_LISTENER_CHANNEL is not None: diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index 883379daf0d2..d1ce34bb6815 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -857,7 +857,7 @@ def parseOptionsAndInitTestdirs(): # Gather all the dirs passed on the command line. if len(args.args) > 0: - testdirs = map(os.path.abspath, args.args) + testdirs = list(map(os.path.abspath, args.args)) # Shut off multiprocessing mode when test directories are specified. no_multiprocess_test_runner = True diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 1b0a8e011a44..29404a805fda 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -186,7 +186,7 @@ def SETTING_MSG(setting): def EnvArray(): """Returns an env variable array from the os.environ map object.""" - return map(lambda k,v: k+"="+v, os.environ.keys(), os.environ.values()) + return list(map(lambda k,v: k+"="+v, os.environ.keys(), os.environ.values())) def line_number(filename, string_to_match): """Helper function to return the line number of the first matched string.""" diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py index 92cb853bc72d..8c23637721a6 100644 --- a/lldb/test/lldbutil.py +++ b/lldb/test/lldbutil.py @@ -77,7 +77,7 @@ def int_to_bytearray(val, bytesize): return None packed = struct.pack(fmt, val) - return bytearray(map(ord, packed)) + return bytearray(list(map(ord, packed))) def bytearray_to_int(bytes, bytesize): """Utility function to convert a bytearray into an integer. @@ -607,7 +607,7 @@ def get_function_names(thread): def GetFuncName(i): return thread.GetFrameAtIndex(i).GetFunctionName() - return map(GetFuncName, range(thread.GetNumFrames())) + return list(map(GetFuncName, 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 map(GetSymbol, range(thread.GetNumFrames())) + return list(map(GetSymbol, 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 map(GetPCAddress, range(thread.GetNumFrames())) + return list(map(GetPCAddress, 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 map(GetFilename, range(thread.GetNumFrames())) + return list(map(GetFilename, 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 map(GetLineNumber, range(thread.GetNumFrames())) + return list(map(GetLineNumber, 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 map(GetModuleName, range(thread.GetNumFrames())) + return list(map(GetModuleName, 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 map(GetStackFrame, range(thread.GetNumFrames())) + return list(map(GetStackFrame, range(thread.GetNumFrames()))) def print_stacktrace(thread, string_buffer = False):