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: WITH_EXCEPT_START? #297

Closed
trec11 opened this issue Nov 29, 2022 · 4 comments
Closed

Unsupported opcode: WITH_EXCEPT_START? #297

trec11 opened this issue Nov 29, 2022 · 4 comments

Comments

@trec11
Copy link

trec11 commented Nov 29, 2022

python3.10
Unsupported opcode: WITH_EXCEPT_START
Unsupported opcode: WITH_EXCEPT_START
Unsupported opcode: WITH_EXCEPT_START
Unsupported opcode: WITH_EXCEPT_START

solution for this?
thanks

@cw2k
Copy link

cw2k commented Dec 11, 2022

Paste that inside ASTree.cpp ( @ BuildFromCode function ) at around line 1790

        case Pyc::POP_EXCEPT:
            /* Do nothing. 
            Pops a value from the stack, which is used to restore the exception state.

            Changed in version 3.11: Exception representation on the stack now consist of one, not three, items.
            */
            break;

        case Pyc::WITH_EXCEPT_START:
          /*
          Calls the function in position 4 on the stack with arguments (type, val, tb) representing the exception at the top of the stack. Used to implement the call context_manager.__exit__(*exc_info()) when an exception has occurred in a with statement.
          New in version 3.9.

          The __exit__ function is in position 4 of the stack rather than 7. Exception representation on the stack now consist of one, not three, items.
          Changed in version 3.11:
          */
        {
          //curblock = ASTBlock::BLK_EXCEPT;
          PycRef<PycString> msg = new PycString();
          msg->setValue(
            "# Decompile 'WITH_EXCEPT_START' is not implemented yet.\n"
          );
          //fputs( msg->strValue, pyc_output);
          OutputString(msg);
          /*
         // TODO: Get that message into the AST (Abtract Syntax Tree) to be shown at the right spot
         //       However that f*** Types in CPP gimme a crisis
         //
         //       ... and again I know why I prefer Python when coding.

                     PycRef<PycString> name = new ASTName( msg );
                     curblock->append(
                           name.cast<PycString>()
                     );
         */
        }
        break;
        
        case Pyc::RERAISE:
        // Re-raises the exception currently on top of the stack. 
        // If oparg is non-zero, pops an additional value from the stack which is used to 
        // set f_lasti of the current frame.
        // New in version 3.9.
        //  Changed in version 3.11: Exception representation on the stack now consist of one, not three, items.
        //https://docs.python.org/3/library/dis.html#opcode-RERAISE

        {
          const char* msg = "# Decompile 'RERAISE' is not implemented yet.\n";
          fputs(msg, pyc_output);
        }
        break;

        case Pyc::POP_TOP:
        ....

I'll do nothing on handling
WITH_EXCEPT_START or RERAISE but I'll make the decompiler go on.

I made a release for that here
https://github.com/cw2k/pycdc_withExe/releases/tag/1%2C0

@NiKoCZ89
Copy link

NiKoCZ89 commented Jan 4, 2023

Paste that inside ASTree.cpp ( @ BuildFromCode function ) at around line 1790

        case Pyc::POP_EXCEPT:
            /* Do nothing. 
            Pops a value from the stack, which is used to restore the exception state.

            Changed in version 3.11: Exception representation on the stack now consist of one, not three, items.
            */
            break;

        case Pyc::WITH_EXCEPT_START:
          /*
          Calls the function in position 4 on the stack with arguments (type, val, tb) representing the exception at the top of the stack. Used to implement the call context_manager.__exit__(*exc_info()) when an exception has occurred in a with statement.
          New in version 3.9.

          The __exit__ function is in position 4 of the stack rather than 7. Exception representation on the stack now consist of one, not three, items.
          Changed in version 3.11:
          */
        {
          //curblock = ASTBlock::BLK_EXCEPT;
          PycRef<PycString> msg = new PycString();
          msg->setValue(
            "# Decompile 'WITH_EXCEPT_START' is not implemented yet.\n"
          );
          //fputs( msg->strValue, pyc_output);
          OutputString(msg);
          /*
         // TODO: Get that message into the AST (Abtract Syntax Tree) to be shown at the right spot
         //       However that f*** Types in CPP gimme a crisis
         //
         //       ... and again I know why I prefer Python when coding.

                     PycRef<PycString> name = new ASTName( msg );
                     curblock->append(
                           name.cast<PycString>()
                     );
         */
        }
        break;
        
        case Pyc::RERAISE:
        // Re-raises the exception currently on top of the stack. 
        // If oparg is non-zero, pops an additional value from the stack which is used to 
        // set f_lasti of the current frame.
        // New in version 3.9.
        //  Changed in version 3.11: Exception representation on the stack now consist of one, not three, items.
        //https://docs.python.org/3/library/dis.html#opcode-RERAISE

        {
          const char* msg = "# Decompile 'RERAISE' is not implemented yet.\n";
          fputs(msg, pyc_output);
        }
        break;

        case Pyc::POP_TOP:
        ....

I'll do nothing on handling WITH_EXCEPT_START or RERAISE but I'll make the decompiler go on.

I made a release for that here https://github.com/cw2k/pycdc_withExe/releases/tag/1%2C0

any fix for this? .exe for windows plsssss
Unsupported opcode: JUMP_IF_NOT_EXC_MATCH
pass

WARNING: Decompyle incomplete

@tjengbudi
Copy link

@NiKoCZ89
i trying yours but it still halt and said decompyle incomplete.

@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

5 participants