?
=?ISO-8859-1?Q?Markus_Sch=F6pflin?=
Hello,
I just stumbled accross a difference between cStringIO in Python 2.4
and 2.5. You can no longer feed arrays to cStringIO.
Python 2.4:
---%<---
ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
--->%---
Python 2.5:
---%<---
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
File "<stdin>", line 1, in <module>
TypeError: expected a character buffer object
--->%---
Has this change been done on purpose or is it a regression?
If it's not a regression, is there another way to feed an array to
cStringIO without expensive conversion?
TIA, Markus
I just stumbled accross a difference between cStringIO in Python 2.4
and 2.5. You can no longer feed arrays to cStringIO.
Python 2.4:
---%<---
ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
<cStringIO.StringI object at 0x0086A248>>>> from array import array
>>> a = array('B', (0, 1, 2))
>>> a array('B', [0, 1, 2])
>>> from StringIO import StringIO
>>> StringIO(a)>>> from cStringIO import StringIO
>>> StringIO(a)
--->%---
Python 2.5:
---%<---
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):>>> from array import array
>>> a = array('B', (0, 1, 2))
>>> a array('B', [0, 1, 2])
>>> from StringIO import StringIO
>>> StringIO(a)>>> from cStringIO import StringIO
>>> StringIO(a)
File "<stdin>", line 1, in <module>
TypeError: expected a character buffer object
--->%---
Has this change been done on purpose or is it a regression?
If it's not a regression, is there another way to feed an array to
cStringIO without expensive conversion?
TIA, Markus