liftoff / pyminifier

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

inline imports must not affect other function variables #56

Open sejans opened 8 years ago

sejans commented 8 years ago

Ignore inline imports, thus allowing variables with same name in another function to be obfuscated correctly

def fun_with_inline_import():
    import random as rnd
    print(rnd.random)

def fun_with_variable():
    rnd = "19,23,45"
    print(rnd.split(","))

The result is:

def fun_with_inline_import():
    import random as rnd
    print(rnd.random)

def fun_with_variable():
    BvuFH = "19,23,45"
    print(rnd.split(","))