From: Gabe Black Date: Tue, 13 Oct 2020 12:00:37 +0000 (-0700) Subject: python: Remove a call to reduce() from code_formatter.py. X-Git-Tag: develop-gem5-snapshot~626 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3e8097f34ffab278ea87ed3e64e6470044ec978;p=gem5.git 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 --- 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' %