From: whitequark Date: Mon, 4 May 2020 05:51:08 +0000 (+0000) Subject: tracer: fix get_var_name() to work on toplevel attributes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3a3f25863ca7f97653ac9b94249f8496f22b6d1;p=nmigen.git tracer: fix get_var_name() to work on toplevel attributes. E.g. this now works: >>> class dummy: pass >>> self = dummy() >>> self.foo = Signal() >>> self.foo.name 'foo' --- diff --git a/nmigen/tracer.py b/nmigen/tracer.py index f02ecd3..17795f3 100644 --- a/nmigen/tracer.py +++ b/nmigen/tracer.py @@ -37,7 +37,7 @@ def get_var_name(depth=2, default=_raise_exception): elif opc == "STORE_DEREF": name_index = int(code.co_code[index + 1]) return code.co_cellvars[name_index] - elif opc in ("LOAD_GLOBAL", "LOAD_ATTR", "LOAD_FAST", "LOAD_DEREF", + elif opc in ("LOAD_GLOBAL", "LOAD_NAME", "LOAD_ATTR", "LOAD_FAST", "LOAD_DEREF", "DUP_TOP", "BUILD_LIST"): index += 2 else: