From 393c27ac8ece9a918c860693e7c495f91ab24bf2 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 4 May 2020 05:51:08 +0000 Subject: [PATCH] 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' --- nmigen/tracer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: -- 2.30.2