This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author reedobrien
Recipients
Date 2007-06-03.05:49:22
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
It appears this is the change that broke it.
http://svn.python.org/view/python/branches/release25-maint/Modules/cStringIO.c?rev=52302&r1=51333&r2=52302

This is the log entry from that changeset:
Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
 (backport from rev. 52301)


Perhaps the cPickle module should be used instead...

BUT at first glance the following seems to make both work:
  if (PyUnicode_Check(s)) 
	{
		if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0)
		{
			PyErr_Format(PyExc_TypeError, "expected character buffer, %.200s found",
				s->ob_type->tp_name); 
			return NULL;
		}
	}
  else
	{
		if (PyObject_AsReadBuffer(s, (const void **)&buf, &size) != 0)
		return NULL;
	}

But the more I think about it the more I think cPickle is more appropriate for this purpose.  In that case I should make a blurb for the docs about not storing arbitrary data in cStringIO. 

Either way I am attaching the cStringIO.c file that worked for me...
File Added: cStringIO.c
History
Date User Action Args
2007-08-23 14:54:29adminlinkissue1730114 messages
2007-08-23 14:54:29admincreate