From 7d71f6641fcb660de0f003e2c028b464d7116ca1 Mon Sep 17 00:00:00 2001
From: Andreas Sandberg <andreas.sandberg@arm.com>
Date: Sat, 26 Jan 2019 09:19:22 +0000
Subject: python: Make iterator handling Python 3 compatible
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Many functions that used to return lists (e.g., dict.items()) now
return iterators and their iterator counterparts (e.g.,
dict.iteritems()) have been removed. Switch calls to the Python 2.7
iterator methods to use the Python 3 equivalent and add explicit list
conversions where necessary.

Change-Id: I0c18114955af8f4932d81fb689a0adb939dafaba
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/15992
Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
---
 src/python/m5/util/code_formatter.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/python/m5/util/code_formatter.py')

diff --git a/src/python/m5/util/code_formatter.py b/src/python/m5/util/code_formatter.py
index 129fbd0e3..c845c9021 100644
--- a/src/python/m5/util/code_formatter.py
+++ b/src/python/m5/util/code_formatter.py
@@ -296,11 +296,11 @@ if __name__ == '__main__':
     f('    $y')
     f('''$__file__:$__line__
 {''')
-    f("${{', '.join(str(x) for x in xrange(4))}}")
+    f("${{', '.join(str(x) for x in range(4))}}")
     f('${x}')
     f('$x')
     f.indent()
-    for i in xrange(5):
+    for i in range(5):
         f('$x')
         f('$i')
         f('$0', "zero")
-- 
cgit v1.2.3