From b6823890dba0cb4b9b80ac6815196b69cbd93216 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Tue, 30 Aug 2022 21:41:25 +0900 Subject: [PATCH] m1n1.utils: RegMap: Fix aliasing... Signed-off-by: Hector Martin --- proxyclient/m1n1/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/proxyclient/m1n1/utils.py b/proxyclient/m1n1/utils.py index 57de4da8..5c48a140 100644 --- a/proxyclient/m1n1/utils.py +++ b/proxyclient/m1n1/utils.py @@ -430,6 +430,13 @@ class RangeMap(Reloadable): self.__end = [] self.__value = [] + def clone(self): + r = type(self)() + r.__start = list(self.__start) + r.__end = list(self.__end) + r.__value = [copy.copy(i) for i in self.__value] + return r + def __len__(self): return len(self.__start) @@ -766,6 +773,10 @@ class RegMapMeta(ReloadableMeta): m._addrmap = {} m._rngmap = SetRangeMap() m._namemap = {} + else: + m._addrmap = dict(m._addrmap) + m._rngmap = m._rngmap.clone() + m._namemap = dict(m._namemap) for k, v in dct.items(): if k.startswith("_") or not isinstance(v, tuple):