cStringIO change in 2.4 vs 2.5. Regression?

Markus Schöpflin nospam at no.spam
Wed Jun 13 06:06:09 EDT 2007


Terry Reedy wrote:

> "Markus Schöpflin" <nospam at no.spam> wrote in message 
> news:f3p07k$u62$1 at nntp.ilk.net...
> | Hello,
> |
> | I just stumbled accross a difference between cStringIO in Python 2.4
> | and 2.5. You can no longer feed arrays to cStringIO.
> [snip]
> | Has this change been done on purpose or is it a regression?
> 
> I doubt that an intentional change would have been made for cStringIO and 
> not StringIO.  Two ways to investigate: scan the detailed listing of 2.5 
> changes for mention of array and cStringIO modules; check the source code 
> checkin messages for both for the relevant time period.  This might also 
> suggest who to send an inquiry to who might not be reading here.

First of all, thank you very much for you answer and sorry for the 
late reply, I was AFK for some days.

I scanned the NEWS file and the only change which caught my attention is

- Patches #1298449 and #1298499: Add some missing checks for error
   returns in cStringIO.c.

but the corresponding check-in doesn't look suspicious.

Next I had a look at the source code of the trunk:

cStringIO.c:newIobject() calls abstract.c:PyObject_AsCharBuffer(), 
which, AFAICT, is the only possible source for the exception reported. 
  The exception is raised when the given object doesn't have 
conversions to an I/O buffer, but when looking at arraymodule.c there 
is array_as_buffer which provides the needed conversions.

The code looks pretty much the same on the 2.5 branch, so I don't have 
an explanation for the observed behaviour.

> If you do not get a satifactory resolution here, file a bug report on SF. 
> But remember that all bug fixers are volunteers just like you, so any 
> investigation you do and report on to make response easier will likely make 
> it quicker also.

I think I'll file a bug at SF... maybe someone else will spot something.

Thanks, Markus



More information about the Python-list mailing list