changeset f467d4db555a in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f467d4db555a
description:
        python: added __nonzero__ function to SimObject Bool params

diffstat:

 src/python/m5/params.py |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 2727a5a0aadc -r f467d4db555a src/python/m5/params.py
--- a/src/python/m5/params.py   Fri Apr 06 13:47:06 2012 -0700
+++ b/src/python/m5/params.py   Fri Apr 06 13:47:07 2012 -0700
@@ -639,6 +639,11 @@
     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'
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to