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'
This commit is contained in:
parent
e301798cee
commit
393c27ac8e
|
|
@ -37,7 +37,7 @@ def get_var_name(depth=2, default=_raise_exception):
|
||||||
elif opc == "STORE_DEREF":
|
elif opc == "STORE_DEREF":
|
||||||
name_index = int(code.co_code[index + 1])
|
name_index = int(code.co_code[index + 1])
|
||||||
return code.co_cellvars[name_index]
|
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"):
|
"DUP_TOP", "BUILD_LIST"):
|
||||||
index += 2
|
index += 2
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue