summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Beckmann <Brad.Beckmann@amd.com>2012-04-06 13:47:07 -0700
committerBrad Beckmann <Brad.Beckmann@amd.com>2012-04-06 13:47:07 -0700
commitf12961bf25f3280576e3ee2e5039eabf92e8204b (patch)
tree143432db29037c9538fa21c6ac02829d983fa993 /src
parentf050ebe3a87b0db01cfe2d6bee4fac083d659665 (diff)
downloadgem5-f12961bf25f3280576e3ee2e5039eabf92e8204b.tar.xz
python: added __nonzero__ function to SimObject Bool params
Diffstat (limited to 'src')
-rw-r--r--src/python/m5/params.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 84af269f0..f5af3a14b 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -639,6 +639,11 @@ class Bool(ParamValue):
def __str__(self):
return str(self.value)
+ # implement truth value testing for Bool parameters so that these params
+ # evaluate correctly during the python configuration phase
+ def __nonzero__(self):
+ return bool(self.value)
+
def ini_str(self):
if self.value:
return 'true'