liftoff / pyminifier

Pyminifier is a Python code minifier, obfuscator, and compressor.
GNU General Public License v3.0
1.46k stars 223 forks source link

--obfuscate-variables - obfuscates class static attributes as well #54

Open sejans opened 8 years ago

sejans commented 8 years ago

the param --obfuscate-variables - obfuscates class static attributes as well, whichi is wrong, because the other code is not obfuscated accordingly and thus it doesnt work after obfuscation. For example: The input

class TClass(object):
    static_attr = "test1"

    def __init__(self):
        self.class_attr = "test2"

pd = TClass()
print(pd.static_attr)
print(TClass.static_attr)
print(pd.class_attr)

The result - which wont compile

class TClass(object):
    QNIoP = "test1" # this line must stay as it was in original, unless you can reference it accordingly

    def __init__(QNIok):
        QNIok.class_attr = "test2"

pd = TClass()
print(pd.static_attr)
print(TClass.static_attr)
print(pd.class_attr)