Closed pfremy closed 10 months ago
github won't let me attach python or pyc files
github won't let me attach python or pyc files
Not a problem here, the report is detailed and simple enough that I can reproduce the problem. A fix for this seems pretty straightforward and I'll make this for decompyle3 which specializes in 3.7 and 3.8 bytecode. Backporting it will be left as an exercise for a volunteer (although until the code bases are brought more in sync, details are a little different, but the same idea).
For the future, to attach python and pyc files, put them both in a zip or tar.gz file.
Thanks for the super quick answer. I read your comments about lack of financial support so I was not expecting this to be fixed that quickly.
I'll check the updated code. It seems to me that there are more ways if/else condition can be incorrectly decompiled. I'll report on decompyle3 for the future.
Speed depends on a number of factors like:
Ooops - looks like I forgot to include in decompyle3 the commit to the code base: https://github.com/rocky/python-decompile3/commit/ed375df6b21ecbddd21cf6aaa37c7673da876751
Description
uncompyle6 fails at this simple condition :
This is actually turned into :
How to Reproduce
Compile then decompile the following function :
You get :
Output Given
No specific error reported.
Expected behavior
In this case, no surprises, it should produce code that is equivalent to the original one, even if not identical.
If a is True, in the original code, the outcome is print('a or not b'). In the compiled code, the outcome is incorrect.
If you remove the first if, you can also get an incorrect decompiling, but with a slightly different transformation.
Environment
Workarounds
Not really so far. I'll check other uncompilers.
Priority
Up to you.