liftoff / pyminifier

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

Does not support Python 3.6 f'{string}' #104

Open chumaumenze opened 6 years ago

chumaumenze commented 6 years ago

The minifier does not support python 3.6 f-string.

Sample.py

name : str = 'Chuma' 
print(f'Hello {name}!')

Minified.py

k=str
t=print
u:k='Chuma'
t(f'Hello {name}!')

It doesn't change the variable name within the f-string causing a NameError whenever executed.

chumaumenze commented 6 years ago

I also does not support '{hi}'.format(hi=hello)

BrendanSimon commented 5 years ago

I use f-strings a lot (because .format() so sooooo ugly). Is this issue on the radar for a fix anytime soon?

I'm guessing not since the last commit was 26-Jun-2015 :(

JamesGuthrie commented 6 months ago

This issue has "fixed itself" as of Python 3.12 thanks to changes to how the tokenizer treats f-strings. For more information, see https://peps.python.org/pep-0701/.