From 5de8626abc9aca4dbae5b81b819475945a2736c8 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Sun, 27 Jan 2019 09:31:31 +0000 Subject: python: Fix param -> int conversion issues Python 3 doesn't convert params to integers automatically in range(). Add __index__ to CheckedInt to enable implicit conversions again. Add explicit conversions where necessary. Change-Id: I2de6c9906d3bb7616f12ada6728b9e4b1928511c Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/16000 Reviewed-by: Nikos Nikoleris Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/python/m5/params.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/python') diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 729fc1242..1470765bb 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -606,6 +606,9 @@ class CheckedInt(NumericParamValue): self.__init__(value) return value + def __index__(self): + return int(self.value) + @classmethod def cxx_predecls(cls, code): # most derived types require this, so we just do it here once -- cgit v1.2.3