Skip to content

Decompile code in the try...return...except format fail #97

@waaaagit

Description

@waaaagit

A return statement between try and except makes decompilation fail to produce correct results.

$ python Python 3.11.1 (main, Sep 8 2025, 16:27:45) [GCC 8.3.0] on linux

def test():
    try:
        a = 1
    except:
        return False
    return False

The pyc file generated by the code above can be decompiled correctly.

def test():
    try:
        return 1
    except:
        return False
    return False

The pyc file generated by the code above can't be decompiled correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions