From: Brad Beckmann Date: Fri, 6 Apr 2012 20:47:07 +0000 (-0700) Subject: python: added __nonzero__ function to SimObject Bool params X-Git-Tag: stable_2012_06_28~139 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f12961bf25f3280576e3ee2e5039eabf92e8204b;p=gem5.git python: added __nonzero__ function to SimObject Bool params --- 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'