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

Expeculated IF/ELIF related function decompiling failure #8

Closed
bloodyshade opened this issue Feb 8, 2012 · 3 comments
Closed

Expeculated IF/ELIF related function decompiling failure #8

bloodyshade opened this issue Feb 8, 2012 · 3 comments
Assignees

Comments

@bloodyshade
Copy link

Hi,

I want to report an issue I've noticed recently and it seems to be related to IF/ELIF statements without ELSE.
For example:

win32com.decimal_23:695-699
       if not res:
           return 0
       elif res._sign:
           return -1
       return 1

disassembly:

430    LOAD_FAST         'res'
433    POP_JUMP_IF_TRUE  '440'
436    LOAD_CONST        ''
439    RETURN_VALUE      ''
440    LOAD_FAST         'res'
443    LOAD_ATTR         '_sign'
446    POP_JUMP_IF_FALSE '453'
449    LOAD_CONST        -1
452    RETURN_VALUE      ''
453    LOAD_CONST        1
456    RETURN_VALUE      ''
-1    RETURN_LAST       ''

Syntax error at or near `RETURN_VALUE' token at offset 456

I also had similar problems with the following files: twisted.python.reflect, twisted.internet.process and pkg_resources.
Though in twisted.internet.process it seems to be related to a try/except block inside a try block, but not really sure.

Regards,
Luis Henrique

@ghost ghost assigned wibiti Feb 9, 2012
@bloodyshade
Copy link
Author

Hi,

Commenting the if/elif block and just leaving the "return 1" also fails to decompile, however if I comment the "return 1" or make it a "else: return 1" it decompiles fine.

EDIT: I just noticed there were a few more elifs without else in the lines before that code, commenting those as well as the if/elif block quoted and only leaving the "return 1" decompiled fine, so yes it really seems to be a problem with if/elif blocks without a matching else.

@wibiti
Copy link
Owner

wibiti commented Feb 9, 2012

I'm working on these errors, and also cleaning up some code in Scanner.py where the bugs are.

uncompyle2 isn't very good at dealing with complex if conditions that span multiple lines; it's one of these earlier in the function that is really causing the error. I have a fix for that error, and I'm working on the other files you mentioned.

@wibiti
Copy link
Owner

wibiti commented Feb 15, 2012

They should be fixed now.

@wibiti wibiti closed this as completed Feb 15, 2012
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

2 participants