From b3e8097f34ffab278ea87ed3e64e6470044ec978 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 13 Oct 2020 05:00:37 -0700 Subject: [PATCH] python: Remove a call to reduce() from code_formatter.py. The built in reduce method is no longer available in python 3. Besides that, this particular bit of code is simpler and easier to read if reduce is replaced with the also built in sum() method. Change-Id: I6daca42494ea0534721dfcfb1f6058517cd482d9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35941 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Reviewed-by: Nikos Nikoleris Maintainer: Gabe Black --- src/python/m5/util/code_formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/m5/util/code_formatter.py b/src/python/m5/util/code_formatter.py index f441df0af..37880de65 100644 --- a/src/python/m5/util/code_formatter.py +++ b/src/python/m5/util/code_formatter.py @@ -266,7 +266,7 @@ class code_formatter(object): lineno = 1 else: lines = format[:i].splitlines(True) - colno = i - reduce(lambda x,y: x+y, (len(z) for z in lines)) + colno = i - sum(len(z) for z in lines) lineno = len(lines) raise ValueError('Invalid format string: line %d, col %d' % -- 2.30.2