summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2012-01-09 20:04:28 -0500
committerAli Saidi <saidi@eecs.umich.edu>2012-01-09 20:04:28 -0500
commite308208f302b6bccff15f7c694e7ed334e870942 (patch)
tree019bd3951f42921399202aee26d0a7df3f044e88
parente826d23a2eae6136f20f74d8d48601ff49349e58 (diff)
downloadgem5-e308208f302b6bccff15f7c694e7ed334e870942.tar.xz
Config: Fix issue with JSON output
-rw-r--r--src/python/m5/SimObject.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index dcc90e1bc..47ca32af2 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -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