liftoff / pyminifier

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

Pyminifier kills singleton tuples #76

Open EricBrunel opened 7 years ago

EricBrunel commented 7 years ago

Singleton tuples are killed by pyminifier: something like "(42,)" is turned into "(42)" by the minification process, which doesn't mean the same thing at all. This happens in minification.py, in the reduce_operators function. At the beginning of the 'else' of the second 'if' in the 'for' loop (line 217 in the version I have), replacing: if token_string in ('}', ')', ']'): with: if token_string in ('}', ']'): solves the issue.