summaryrefslogtreecommitdiff
path: root/src/python/m5
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2019-01-25 12:00:20 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2019-02-12 17:06:35 +0000
commit6e08be1ec41342e0710f5335b79cae7986822862 (patch)
tree1e9ce711b0fb63d7daa7d3234d346d4041f5d758 /src/python/m5
parentbc42d2fa8bc7fc2bd610011993ac168e8f5f41d3 (diff)
downloadgem5-6e08be1ec41342e0710f5335b79cae7986822862.tar.xz
python: Replace DictMixin with Mapping / MutableMapping
Python 3 has removed support for DictMixin, so switch to Mapping / MutableMapping in collections which provides the same functionality. Change-Id: I61fbe366d2c9fc6e01b470f82f49cc02b99dec32 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15984 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/python/m5')
-rw-r--r--src/python/m5/debug.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py
index f7e34a728..d2892f7e3 100644
--- a/src/python/m5/debug.py
+++ b/src/python/m5/debug.py
@@ -28,7 +28,7 @@
from __future__ import print_function
-from UserDict import DictMixin
+from collections import Mapping
import _m5.debug
from _m5.debug import SimpleFlag, CompoundFlag
@@ -56,7 +56,7 @@ def help():
printList([ c.name() for c in children ], indent=8)
print()
-class AllFlags(DictMixin):
+class AllFlags(Mapping):
def __init__(self):
self._version = -1
self._dict = {}
@@ -79,6 +79,14 @@ class AllFlags(DictMixin):
self._update()
return self._dict[item]
+ def __iter__(self):
+ self._update()
+ return iter(self._dict)
+
+ def __len__(self):
+ self._update()
+ return len(self._dict)
+
def keys(self):
self._update()
return self._dict.keys()
@@ -91,16 +99,4 @@ class AllFlags(DictMixin):
self._update()
return self._dict.items()
- def iterkeys(self):
- self._update()
- return self._dict.iterkeys()
-
- def itervalues(self):
- self._update()
- return self._dict.itervalues()
-
- def iteritems(self):
- self._update()
- return self._dict.iteritems()
-
flags = AllFlags()