pycdc icon indicating copy to clipboard operation
pycdc copied to clipboard

Unsupported opcode: LOAD_BUILD_CLASS

Open schlamar opened this issue 13 years ago • 4 comments

Cannot decompile for Python 3.3. It fails with the above message.

schlamar avatar Sep 27 '13 14:09 schlamar

+1

arielvb avatar Nov 27 '13 12:11 arielvb

This is not trivial to implement, and I haven't had any time to work on pycdc recently. For those interested in looking at it, the summary of the issue is thus:

Python 2.x compiles a class declaration by pushing the class name, bases, and code object on the stack, and then calling the BUILD_CLASS opcode, which pops those three objects and pushes a class declaration object onto the stack in their place.

Python 3.x instead uses the LOAD_BUILD_CLASS opcode, which finds and pushes the built-in object __builtins__.__build_class__ onto the stack, and then subsequently calls this function from Python rather than C. Therefore, we need to distinguish this special object on the stack, and properly recognize that it should emit a class declaration when called, rather than trying to emit a function call.

zrax avatar Nov 27 '13 18:11 zrax

experiencing this as well, too bad I couldn't help :(

cyrusdavid avatar Apr 06 '14 01:04 cyrusdavid

This code should really be wrapped in an if() for the specific version, it adds confusion when trying to work out what CALL_FUNCTION is doing.

reductor avatar May 21 '16 08:05 reductor