On Tue, Sep 10, 2019 at 10:42:52AM -0400, Daniel Holth wrote:
I stopped using Python 3 after learning about str(bytes) by finding it in my corrupted database. Ever since then I've been anxious about changing to the new language, since it makes it so easy to convert from bytes to unicode by accident without specifying a valid encoding. So I would like to see a future where str(bytes) is effectively removed. I started working on a pull request that adds an API to toggle str(bytes) at runtime with a thread local (instead of requiring a command line argument), so you could do with no_str_bytes(): if you were worried about the feature, but got a bit stuck in the internals.
How is this different than all the str -> unicode bugs we had in python2? If you have special needs, you can always monkey-patch it in plain python code by overriding __builtins__.str with something that asserts the given arg is not bytes. m -- Matt Billenstein matt@vazor.com http://www.vazor.com/