[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions

sorin report at bugs.python.org
Sat Jun 25 19:10:24 CEST 2011


sorin <sorin.sbarnea at gmail.com> added the comment:

You are right, I debugged the problem a little more and discovered at least one bug in PyAMF.

Still, I was surprised to find out something very strange, it look that BytesIO.getvalue() does return `str` even if the documentation says it does return `bytes`. Should I file another bug?

Python 2.7.1 (r271:86832, Jun 13 2011, 14:28:51) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> a = io.BytesIO()
>>> a
<_io.BytesIO object at 0x10f9453b0>
>>> a.getvalue()
''
>>> print type(a.getvalue())
<type 'str'>
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12398>
_______________________________________


More information about the Python-bugs-list mailing list