A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-August/074102.html below:

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

[Python-Dev] cStringIO.StringIO() buffer behavior [Python-Dev] cStringIO.StringIO() buffer behaviorAlexandre Vassalotti alexandre at peadrop.com
Sun Aug 5 20:48:11 CEST 2007
On 8/5/07, Georg Brandl <g.brandl at gmx.net> wrote:
> 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?
>

The best thing would be add a special case for ascii-only unicode
objects, and keep the old behavior. However, I believe this will be
ugly, especially in O_write. So, it would perhaps be better to simply
stop supporting unicode objects.

-- Alexandre
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4