Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

while if continue return sequence #32

@rocky

Description

@rocky

Decompiling bytecode for:

def test(a):
    while True:
        if a:
            pass
        else:
            continue
        return

gives:

:Traceback (most recent call last):
  File "/src/external-vcs/github/uncompyle2/uncompyle2/__init__.py", line 203, in main
    uncompyle_file(infile, outstream, showasm, showast)
  File "/src/external-vcs/github/uncompyle2/uncompyle2/__init__.py", line 140, in uncompyle_file
    uncompyle(version, co, outstream, showasm, showast)
  File "/src/external-vcs/github/uncompyle2/uncompyle2/__init__.py", line 129, in uncompyle
    raise walk.ERROR
ParserError: --- This code section failed: ---

0	SETUP_LOOP        '26'
3	LOAD_GLOBAL       'True'
6	POP_JUMP_IF_FALSE '25'

9	LOAD_FAST         'a'
12	POP_JUMP_IF_FALSE '3'

15	JUMP_FORWARD      '21'

18	CONTINUE          '3'
21_0	COME_FROM         '15'

21	LOAD_CONST        None
24	RETURN_END_IF     None
25	POP_BLOCK         None
26_0	COME_FROM         '0'

Syntax error at or near `POP_BLOCK' token at offset 25

That RETURN_END_IF in fact is not the end of the if/else which ends after the continue instruction on line 18.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions