3 ms·
I feel like this proposal didn't learn its lesson from the need to port u'' string prefixes to Python 3.2. How would one write a string that should not need int
by Macha 7y ago
I feel like this proposal didn't learn its lesson from the need to port u'' string prefixes to Python 3.2. How would one write a string that should not need interpolation in current Python versions so it doesn't silently get interpolated in Python 3.defaultfstrings? I also worry about codebases that don't get updated, seem to work, but silently open up attacks:
like the following:
username = some_request_variable_1
password = some_request_variable_2
sql = 'INSERT INTO users (username, password) VALUES ({username}, {password})'.format(
escape(username),
hash(password, salt, per_user_salt)
)'
Good code? No. Exists in the real world? Almost certainly. Safe in Python currently? Assuming escape is implemented correctly. Safe in f-strings by default world? No.
This also seems way less pressing than "most Python programs silently handle unicode wrong" as a reason to change the language.