pycdc
pycdc copied to clipboard
Unsupported opcode: JUMP_IF_NOT_EXC_MATCH any fix?
Unsupported opcode: JUMP_IF_NOT_EXC_MATCH pass
WARNING: Decompyle incomplete
any fix?
edit ASTree.cpp , comment default branch ,and recompile it
default:
stack.pop();
// fprintf(stderr, "Unsupported opcode: %s\n", Pyc::OpcodeName(opcode & 0xFF));
// cleanBuild = false;
// return new ASTNodeList(defblock->nodes());
@Hexmagic Your tweak works :+1:
edit ASTree.cpp , comment default branch ,and recompile it
default: stack.pop(); // fprintf(stderr, "Unsupported opcode: %s\n", Pyc::OpcodeName(opcode & 0xFF)); // cleanBuild = false; // return new ASTNodeList(defblock->nodes());
It's not how you are supposed to handle this.
This opcode occurs in Python 3.10 in simple functions like the one shown below.
def f(x):
try:
...
except Exception:
return x
The disassembly of this function is (as given by dis.dis
):
3 0 SETUP_FINALLY 3 (to 8)
4 2 LOAD_FAST 0 (x)
4 POP_BLOCK
6 RETURN_VALUE
5 >> 8 DUP_TOP
10 LOAD_GLOBAL 0 (Exception)
12 JUMP_IF_NOT_EXC_MATCH 14 (to 28)
14 POP_TOP
16 POP_TOP
18 POP_TOP
6 20 LOAD_FAST 0 (x)
22 ROT_FOUR
24 POP_EXCEPT
26 RETURN_VALUE
5 >> 28 RERAISE 0
The behaviour of the opcode is:
JUMP_IF_NOT_EXC_MATCH
: Tests whether the second value on the stack is an exception matching TOS, and jumps if it is not. Pops two values from the stack. .. versionadded:: 3.9
Unsupported opcode: JUMP_IF_NOT_EXC_MATCH Warning: block stack is not empty!
What to do?
Duplicate #450