[Python-Dev] cStringIO.StringIO() buffer behavior

Georg Brandl g.brandl at gmx.net
Sun Aug 5 16:51:25 CEST 2007


See bugs #1548891 and #1730114.

In the former, it was reported that cStringIO works differently from StringIO
when handling unicode strings; it used GetReadBuffer which returned the raw
internal UCS-2 or UCS-4 encoded string.

I changed it to use GetCharBuffer, which converts to a string using the
default encoding first. This fix was also in 2.5.1.

The latter bug now complains that this excludes things like array.array()s
from being used as an argument to cStringIO.StringIO(), which worked before
with GetReadBuffer.

What's the preferred solution here?

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list