bank/description/AutoReg: check that get_memories and get_registers are callable

This commit is contained in:
Sebastien Bourdeauducq 2013-03-10 18:11:29 +01:00
parent 68fe4c269c
commit cddbc1157d
1 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class AutoReg:
for k, v in self.__dict__.items(): for k, v in self.__dict__.items():
if isinstance(v, Memory): if isinstance(v, Memory):
r.append(v) r.append(v)
elif hasattr(v, "get_memories"): elif hasattr(v, "get_memories") and callable(v.get_memories):
r += memprefix(k + "_", v.get_memories()) r += memprefix(k + "_", v.get_memories())
return sorted(r, key=lambda x: x.huid) return sorted(r, key=lambda x: x.huid)
@ -76,7 +76,7 @@ class AutoReg:
for k, v in self.__dict__.items(): for k, v in self.__dict__.items():
if isinstance(v, Register): if isinstance(v, Register):
r.append(v) r.append(v)
elif hasattr(v, "get_registers"): elif hasattr(v, "get_registers") and callable(v.get_registers):
r += regprefix(k + "_", v.get_registers()) r += regprefix(k + "_", v.get_registers())
return sorted(r, key=lambda x: x.huid) return sorted(r, key=lambda x: x.huid)