pycdc icon indicating copy to clipboard operation
pycdc copied to clipboard

Unsupported opcode: JUMP_IF_NOT_EXC_MATCH any fix?

Open NiKoCZ89 opened this issue 2 years ago • 6 comments

Unsupported opcode: JUMP_IF_NOT_EXC_MATCH pass

WARNING: Decompyle incomplete

any fix?

NiKoCZ89 avatar Jan 04 '23 13:01 NiKoCZ89

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 avatar Jan 13 '23 16:01 Hexmagic

@Hexmagic Your tweak works :+1:

persianpros avatar Jan 17 '23 00:01 persianpros

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.

TheHellTower avatar Jan 17 '23 00:01 TheHellTower

SystemInfo.zip

Example I tested.

persianpros avatar Jan 17 '23 00:01 persianpros

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

LukeSerne avatar Mar 24 '23 14:03 LukeSerne

Unsupported opcode: JUMP_IF_NOT_EXC_MATCH Warning: block stack is not empty!

What to do?

Muhammadyusuf96 avatar Jan 29 '24 13:01 Muhammadyusuf96

Duplicate #450

zrax avatar Feb 21 '24 22:02 zrax