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

Error of "if if else" expr sequence #351

Open
hzqmwne opened this issue Jun 15, 2021 · 2 comments
Open

Error of "if if else" expr sequence #351

hzqmwne opened this issue Jun 15, 2021 · 2 comments
Labels
Control Flow Problem has to do with bad control-flow detection Works on decompyle3

Comments

@hzqmwne
Copy link

hzqmwne commented Jun 15, 2021

Description

Error of "if if else" expr sequence

How to Reproduce

here is the source code test.py:

a = 1
b = 1
if a:
    print("a")
if b:
    print("b")
else:
    print("else")

then compile it with:

python3 -m compileall -b test.py

and decompile it

uncompyle6 test.pyc >test_dec.py

the output is:

a = 1
b = 1
if a:
    print('a')
elif b:
    print('b')
else:
    print('else')

the decompiled code is quite different from the origin code
if run the code, it will print:

$ python3 test.py
a
b
$ python3 test_dec.py
a

Expected behavior

expected decompiled code may look like this:

a = 1
b = 1
if a:
    print("a")
if b:
    print("b")
else:
    print("else")

Environment

this bug can be repeated in such environments:

Ubuntu 20.04
Python 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0] on linux
uncompyle6 3.7.4 from pip

or

Ubuntu 18.04
Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
uncompyle6 3.7.4 from pip

Additional Environment or Context

This bug does not exist in decompile3, but decompile3 cannot handler python3.6 bytecode.

@rocky rocky added the insufficient bug report The instructions given when opening a new issue are not followed label Jun 15, 2021
@rocky
Copy link
Owner

rocky commented Jun 15, 2021

Please look at the information in https://github.com/rocky/python-uncompyle6/issues/new?&template=bug-report.md especially the "Environment" sections. Also, have looked to see if this has been reported before?

@hzqmwne
Copy link
Author

hzqmwne commented Jun 15, 2021

Please look at the information in https://github.com/rocky/python-uncompyle6/issues/new?&template=bug-report.md especially the "Environment" sections. Also, have looked to see if this has been reported before?

I've updated the bug-report. Sorry for the inconvenience.
I've looked through all opened issues and have not seen other reports.

@rocky rocky added Control Flow Problem has to do with bad control-flow detection Works on decompyle3 and removed insufficient bug report The instructions given when opening a new issue are not followed labels Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Control Flow Problem has to do with bad control-flow detection Works on decompyle3
Projects
None yet
Development

No branches or pull requests

2 participants