[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions
Terry J. Reedy
report at bugs.python.org
Sat Jun 25 20:31:39 CEST 2011
Terry J. Reedy <tjreedy at udel.edu> added the comment:
In 2.7, bytes is an alias for str to aid porting to 3.x.
>>> bytes is str
I suspect the doc uses 'bytes' rather than 'str' because it was backported from 3.x. Perhaps it should be changed but I do not know the policy on using the alias in 2.6/7 docs.
I presume in 2.7 io.BytesIO is similar, if not equivalent to io.StringIO, but it is not an alias. Again, it was added so 2.7 code could use a bytes memory buffer that would remain bytes in 3.x and not become unicode text, like StringIO does.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list