Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported opcode: JUMP_IF_NOT_EXC_MATCH any fix? #307

Closed
NiKoCZ89 opened this issue Jan 4, 2023 · 7 comments
Closed

Unsupported opcode: JUMP_IF_NOT_EXC_MATCH any fix? #307

NiKoCZ89 opened this issue Jan 4, 2023 · 7 comments

Comments

@NiKoCZ89
Copy link

NiKoCZ89 commented Jan 4, 2023

Unsupported opcode: JUMP_IF_NOT_EXC_MATCH
pass

WARNING: Decompyle incomplete

any fix?

@Hexmagic
Copy link

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());

@persianpros
Copy link

persianpros commented Jan 17, 2023

@Hexmagic Your tweak works 👍

@TheHellTower
Copy link
Contributor

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.

@persianpros
Copy link

SystemInfo.zip

Example I tested.

@LukeSerne
Copy link

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

kamuridesu referenced this issue in kamuridesu/pycdc Apr 27, 2023
this is far from the ideal solution, as the code comes incomplete, but is better than not decompiling the file at all

this workaround was proposed by https://github.com/zrax/pycdc/issues/307\#issuecomment-1382103504
kamuridesu referenced this issue in kamuridesu/pycdc Apr 27, 2023
this is far from the ideal solution, as the code comes incomplete, but is better than not decompiling the file at all

this workaround was proposed by https://github.com/zrax/pycdc/issues/307\#issuecomment-1382103504
@Muhammadyusuf96
Copy link

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

What to do?

@zrax
Copy link
Owner

zrax commented Feb 21, 2024

Duplicate #450

@zrax zrax closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants