Mysterie / uncompyle2

uncompyle2
642 stars 148 forks source link

Failure in decompilation of function call with expression in arguments #7

Closed hedger closed 11 years ago

hedger commented 11 years ago

Under 2.6.4:

test(a == b == c == 1)

fails to decompile:

ParserError: --- This code section failed: ---

0       LOAD_NAME         'test'
3       LOAD_NAME         'a'
6       LOAD_NAME         'b'
9       DUP_TOP           None
10      ROT_THREE         None
11      COMPARE_OP        '=='
14      JUMP_IF_FALSE     '37'
17      LOAD_NAME         'c'
20      DUP_TOP           None
21      ROT_THREE         None
22      COMPARE_OP        '=='
25_0    COME_FROM         '14'
25      JUMP_IF_FALSE     '37'
28      LOAD_CONST        1
31      COMPARE_OP        '=='
34      JUMP_FORWARD      '39'
37      ROT_TWO           None
38      POP_TOP           None
39_0    COME_FROM         '34'
39      CALL_FUNCTION_1   None
42      POP_TOP           None

Syntax error at or near `COME_FROM' token at offset 25_0
hedger commented 11 years ago

Here's the *.pyc in case if you need it: http://www.mediafire.com/?khflhb3ld5vs8a2

Mysterie commented 11 years ago

I've patch the issue. https://github.com/Mysterie/uncompyle2/commit/b835655213a6d2aa722f9bd94b628b266bf90bd8 A bug in comparison expressions is introduce because JUMP_IF_FALSE_OR_POP opcode dosen't exist in python 2.5 & 2.6. Thx for the report :)

hedger commented 11 years ago

Thank you!