summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2009-09-22 15:24:16 -0700
committerNathan Binkert <nate@binkert.org>2009-09-22 15:24:16 -0700
commiteec67312b5990dd73c6330e74bff978ad300f780 (patch)
treef3812c7a1f48821838f5546097b563674af90080
parentaa78db4adab413600547dc01a9f1db2fbbe8fa44 (diff)
downloadgem5-eec67312b5990dd73c6330e74bff978ad300f780.tar.xz
attrdict: add pickle support to attrdict
-rw-r--r--src/python/m5/util/attrdict.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/python/m5/util/attrdict.py b/src/python/m5/util/attrdict.py
index 0b30258b9..3336632f5 100644
--- a/src/python/m5/util/attrdict.py
+++ b/src/python/m5/util/attrdict.py
@@ -45,6 +45,12 @@ class attrdict(dict):
return self.__delitem__(attr)
return super(attrdict, self).__delattr__(attr)
+ def __getstate__(self):
+ return dict(self)
+
+ def __setstate__(self, state):
+ self.update(state)
+
class multiattrdict(attrdict):
"""Wrap attrdict so that nested attribute accesses automatically create
nested dictionaries."""