This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients eryksun, ezio.melotti, lemburg, r.david.murray, serhiy.storchaka, vstinner
Date 2015-04-22.14:48:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <5537B4C0.8020407@egenix.com>
In-reply-to <1429710754.69.0.366392214947.issue24025@psf.upfronthosting.co.za>
Content
On 22.04.2015 15:52, R. David Murray wrote:
> str accepting bytes and returning the repr was a conscious design choice, as evidenced by the -bb option, and I'm sure there is code that is both unintentionally and *intentionally* using this, despite the warning.  Unless we want to discuss making the -bb behavior the default in a future version of python, this issue should be closed.

I guess that would be helpful, yes.

Here's the original patch which introduced -b and -bb:

http://bugs.python.org/issue1392

This was Guido's answer back then:

"""
I'll look at the patches later, but we've gone over this before on the
list. str() of *any* object needs to return *something*. Yes, it's
unfortunate that this masks bugs in the transitional period, but it
really is the best thing in the long run. We had other exceptional
treatement for str vs. bytes (e.g. the comparison was raising TypeError
for a while) and we had to kill that too.
"""

I'm not sure what the "transitional period" refers to, though.
It's 8 years later now and doesn't look like str(bytes_object) will
go away a source of subtle bugs anytime soon :-)
History
Date User Action Args
2015-04-22 14:48:38lemburgsetrecipients: + lemburg, vstinner, ezio.melotti, r.david.murray, serhiy.storchaka, eryksun
2015-04-22 14:48:38lemburglinkissue24025 messages
2015-04-22 14:48:37lemburgcreate