pyminifier
pyminifier copied to clipboard
Variable scope is not checked
Hi, I just found there's a probability when I use single-character variable.
So, I have codes like this:
...
IDINFO_JSON = "idinfo.json"
...
def main():
if not os.path.exists(IDINFO_JSON):
sys.exit(-1)
...
r = requests.post(...)
...
...
After pyminifier -O, it potentially becomes this code:
...
r="idinfo.json"
...
def main():
if not os.path.exists(r):
G(-1)
...
r = i(...)
...
...
And because of the variable scope issue, when i run the codes, it meets an error:
UnboundLocalError: local variable 'r' referenced before assignment