Config: Fix issue with JSON output
authorAli Saidi <saidi@eecs.umich.edu>
Tue, 10 Jan 2012 01:04:28 +0000 (20:04 -0500)
committerAli Saidi <saidi@eecs.umich.edu>
Tue, 10 Jan 2012 01:04:28 +0000 (20:04 -0500)
src/python/m5/SimObject.py

index dcc90e1bc1914b5e8286a0591573897e6c213a4b..47ca32af266dc7136cb2ca1769ddd82e2058045f 100644 (file)
@@ -905,7 +905,15 @@ class SimObject(object):
         for param in sorted(self._params.keys()):
             value = self._values.get(param)
             try:
-                d[param] = self._values[param].value
+                # Use native type for those supported by JSON and 
+                # strings for everything else. skipkeys=True seems
+                # to not work as well as one would hope
+                if type(self._values[param].value) in \
+                        [str, unicode, int, long, float, bool, None]:
+                    d[param] = self._values[param].value
+                else:
+                    d[param] = str(self._values[param])
+
             except AttributeError:
                 pass