| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Also, the same commit(4ac5564) caused this issue will also cause empty function/module/class decompile to return instead of pass for both python2 and python3: class Test:
passDecompiled: class Test:
returnI haven't figure out how to resolve this. |
Sorry, something went wrong.
|
@wangym5106 For the next week and a half, I'm out of town on vacation. I will look at this, though, when I get home. |
Sorry, something went wrong.
|
I just had a chance to look at. Allow me to give a high-level overview. At the base level, the return None is redundant. Redundant isn't per se wrong, just unnecessary. I've been a little sloppy here, and I guess my excuse is that there's so much other stuff that's wrong, that this has taken priority. And it's also taken me a while to try to organize the process to make sense so tht the code can scale easily. The good part of the PR is that the changes here are done after scanning and parsing. For things like this — what we have is correct but maybe not idiomatic — what is used is a "transformation rule" See https://github.com/rocky/python-uncompyle6/blob/master/uncompyle6/semantics/transform.py for examples of transformation rules. This is also mentioned briefly in the BlackHat Asia talk. |
Sorry, something went wrong.
|
This issue and another issue (#521 , that's a real wrong) is both caused by same reason: different attr & pattr between python 2 and 3. So for a better fix for these issues, can we unify the attr & pattr across python versions? |
Sorry, something went wrong.
|
@wangym5106 want to try revising this as a transformation rule for n_return? |
Sorry, something went wrong.
|
I'd like to. But actually all L1250-L1270 is for removing redundant return, should be move to a transformation rule. For this specific issue, it's caused by redundant return is removed successfully in python3 but failed in python2. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
For example:
Decompiled result:
# uncompyle6 version 3.9.3.dev0 # Python bytecode version base 2.7 (62211) # Decompiled from: Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] # Embedded file name: /cwd/test.py # Compiled at: 2025-11-21 19:12:13 def test(): c = 1 return return # okay decompiling .\test.pycThis issue is caused by 4ac5564, will produce redundant return for every function in python 2.7.
This PR will fix it.