The opcode itself is exactly the same as LOAD_DEREF.
The problem is when the class is a closure (e.g. defined inside a function body) then there is a BUILD_TUPLE after the LOAD_BUILD_CLASS which makes problems. In this case I just added a check in the BUILD_TUPLE opcode to break if the TOS is NODE_LOADBUILDCLASS.
There is another problem which makes the code->name() of the class to be part of the function locals. (e.g. func.<locals>.my_class instead of my_class) which makes the check srcString->isEqual(code->name().cast<PycObject>()) be invalid. Here I removed this check and another one that checks if the srcString != nullptr
The opcode itself is exactly the same as
LOAD_DEREF
.The problem is when the class is a closure (e.g. defined inside a function body) then there is a
BUILD_TUPLE
after theLOAD_BUILD_CLASS
which makes problems. In this case I just added a check in theBUILD_TUPLE
opcode to break if the TOS isNODE_LOADBUILDCLASS
.There is another problem which makes the
code->name()
of the class to be part of the function locals. (e.g.func.<locals>.my_class
instead ofmy_class
) which makes the checksrcString->isEqual(code->name().cast<PycObject>())
be invalid. Here I removed this check and another one that checks if thesrcString != nullptr