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

Nested while1 loops with "break" along with "continue" #66

Open
rocky opened this issue Feb 15, 2020 · 0 comments
Open

Nested while1 loops with "break" along with "continue" #66

rocky opened this issue Feb 15, 2020 · 0 comments

Comments

@rocky
Copy link

rocky commented Feb 15, 2020

This code:

# Adapted From 2.4.6 sre.py
def _parse2(source, state):
    while 1:
        if a:
            if b:
                while 1:
                    this = 1
                    break
                continue

        while 1:
            if b:
                break

        x = 3

while compiled and decompiled gives:

uncompyle2  bug-sre-2.7.pyc 
# 2020.02.15 08:19:44 EST
#Embedded file name: exec


def _parse2--- This code section failed: ---

0	SETUP_LOOP        '65'

3	LOAD_GLOBAL       'a'
6	POP_JUMP_IF_FALSE '38'

9	LOAD_GLOBAL       'b'
12	POP_JUMP_IF_FALSE '38'

15	SETUP_LOOP        '29'

18	LOAD_CONST        1
21	STORE_FAST        'this'

24	BREAK_LOOP        None
25	JUMP_BACK         '18'
28	POP_BLOCK         None
29_0	COME_FROM         '15'

29	CONTINUE          '3'
32	JUMP_ABSOLUTE     '38'
35	JUMP_FORWARD      '38'
38_0	COME_FROM         '35'

38	SETUP_LOOP        '55'

41	LOAD_GLOBAL       'b'
44	POP_JUMP_IF_FALSE '41'

47	BREAK_LOOP        None
48	JUMP_BACK         '41'
51	JUMP_BACK         '41'
54	POP_BLOCK         None
55_0	COME_FROM         '38'

55	LOAD_CONST        3
58	STORE_FAST        'x'
61	JUMP_BACK         '3'
64	POP_BLOCK         None
65_0	COME_FROM         '0'

Syntax error at or near `POP_BLOCK' token at offset 28
### Can't uncompyle bug-sre-2.7.pyc
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/uncompyle2/__init__.py", line 197, in main
    uncompyle_file(infile, outstream, showasm, showast, deob)
  File "build/bdist.linux-x86_64/egg/uncompyle2/__init__.py", line 130, in uncompyle_file
    uncompyle(version, co, outstream, showasm, showast, deob)
  File "build/bdist.linux-x86_64/egg/uncompyle2/__init__.py", line 123, in uncompyle
    raise walker.ERROR
ParserError: --- This code section failed: ---

0	SETUP_LOOP        '65'

3	LOAD_GLOBAL       'a'
6	POP_JUMP_IF_FALSE '38'

9	LOAD_GLOBAL       'b'
12	POP_JUMP_IF_FALSE '38'

15	SETUP_LOOP        '29'

18	LOAD_CONST        1
21	STORE_FAST        'this'

24	BREAK_LOOP        None
25	JUMP_BACK         '18'
28	POP_BLOCK         None
29_0	COME_FROM         '15'

29	CONTINUE          '3'
32	JUMP_ABSOLUTE     '38'
35	JUMP_FORWARD      '38'
38_0	COME_FROM         '35'

38	SETUP_LOOP        '55'

41	LOAD_GLOBAL       'b'
44	POP_JUMP_IF_FALSE '41'

47	BREAK_LOOP        None
48	JUMP_BACK         '41'
51	JUMP_BACK         '41'
54	POP_BLOCK         None
55_0	COME_FROM         '38'

55	LOAD_CONST        3
58	STORE_FAST        'x'
61	JUMP_BACK         '3'
64	POP_BLOCK         None
65_0	COME_FROM         '0'

Syntax error at or near `POP_BLOCK' token at offset 28
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
# 2020.02.15 08:19:44 EST

rocky/python-uncompyle6@3512745

is what I used to fix in uncompyle6., but I think you need to change the "JUMP_ABSOLUTE" to "CONTINUE".

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

1 participant