[Python-Dev] Re: python3 -bb and hash collisions
On Tue, Sep 10, 2019 at 8:38 PM Matt Billenstein wrote: > 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 > m...@vazor.com > http://www.vazor.com/ > It's different. One hint is that there's already an option to disable the feature. The old style of error will occasionally reveal itself with decode errors but the new style error happens silently, you discover it somehow, then enable the -bb option, track down the source of the error, and deal with the fallout. The proposed change would allow `print(bytes)` for (de)bugging by letting you toggle `python3 -bb` behavior at runtime instead of only at the command line. Or you could debug more explicitly by `print(bytes.decode('ebcdic'))` or `print(repr(bytes))` I didn't realize you could override __builtins__.str. That's interesting. ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/I5RQRUGLAKLZ6TLPSO2S5VRL5D4CQNGT/
[Python-Dev] Re: Python for Windows (python-3.7.4.exe) location confusing
On 10Sep2019 2120, Jim J. Jewett wrote: Is it possible for the installer to check whether or not there is a pre-existing system-wide launcher, and only do the complicated stuff if it is actually there? I'm not sure what you're referring to here. If there's a pre-existing launcher of the same or higher version, it won't try to install it and won't ask for administrative privileges. This has worked since Python 3.5. But you mention "only do ... stuff if ... there" - what stuff are you referring to? The installer should do *less* if it's partially installed already, not more. Cheers, Steve ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/IRULRSHYJUWENLUESGO7ZHIUJPHLJZ6R/
[Python-Dev] Re: Python for Windows (python-3.7.4.exe) location confusing
On Wed, Sep 11, 2019 at 5:36 AM Steve Dower wrote: > But you mention "only do ... stuff if ... there" - what stuff are you > referring to? The installer should do *less* if it's partially installed > already, not more. My understanding was that (1) You believe the py.exe launcher should be installed per-user, at least if python itself is installed per-user. (2) In the past (~3.4) it was installed for all users (even if python was per-user). (3) If there is an old py.exe in the system-wide location, that will mask any per-user py.exe. (4) Therefore, py.exe defaults to installing in the system-wide location, to avoid being masked. (5) You were wondering whether 3.4 is old enough to stop worrying. My suggestion is to instead check whether or not there is actually a py.exe in the system-wide location. If so, then go ahead and update or remove it. If not, then you don't need to worry about whether or not 3.4 is sufficiently old -- it is irrelevant on this particular system. -jJ ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/3ULELQOJP6EPZFKPPLFSVEGVDNIFZHY5/