-
-
Notifications
You must be signed in to change notification settings - Fork 450
Python 3.7 decompiling full lib #240
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
Conversation
|
About failed tests, this work is in progress. |
|
@x0ret looking at the diff I don't see any problem. Adding the label _SETUP or _LOOP was supposed to help, but if it doesn't no problem. But exactly what is an example of a for loop that uses generates code that matches the rule? |
|
The example is the if a == 10:
print(0)
else:
if 11 <= a <= 15:
for i in range(10):
print(i)
else:
print(3)for earlier versions like however after our changes in Please note I will commit all my testcases later. Thanks. |
|
Thanks for the additional information. This helps me understand things a lot. It also give a good example of what I was talking about with the dishonest come-froms, and why we need something like python control flow to do better. If you look at the 3.6 code the It seems to be put there so as to mark where the loop ends. Here Python could have probably had I am guessing that the reason this is working in 3.6 is because there is a pseudo instruction In 3.7 the In 3.8 I tried looking to see how python-control-flow handles this. It creates the control-flow graph and dominators correctly, but it comes up with the wrong control flow. I will look at how to fix that over the weekend. I will also create a new decompile project for just 3.7 stripped down from uncompyle6. |
|
I spent some time looking at this. I am now of the opinion that fixing this up properly at this stage is just too much work, so we not merge this. And just live with the bugs for now. I'll create a new repository for Python 3.7 and beyond and start stripping things and maybe we can add better ways to do control flow there. Possibly at some point this can get backported. The next iteration that I have tried but not committed adds and/or terminators where the COME_FROMs were improperly placed. Noting the end of an and/or is not dishonest and narrows that use. What do you think? |
|
Thanks for that, I agree with you. Besides i'm so interested in |
Absolutely. That was the whole point behind creating this. |
|
Great. Please count on me in the developing process. |
|
Ok. https://github.com/rocky/python-decompile3/ is now there. It minimally runs. There are some run errors that need fixing,. Some older code is around because it was imported/subclassed. I will rebase things off of 3.7 later. There is a way to dump the grammar. There is also a parser profiler so you can see which rules are not used. But this is all the time I can spend on this for now. Go at it! I am closing this PR. But we should keep the branch around. I'll be putting out a release with everything else soon. |
This is for getting ready for finalizing python 3.7 decompiler.
@rocky, Please check the
continueforCOME_FROM_LOOPinscanner3.pysince i didn't find a proper way. Since we changedCOME_FROMproc,COME_FROM_LOOPwill be at it's correct location but i couldn't adjust a proper grammer for it.