[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndex/Splitter/UnicodeSplitter/src - UnicodeSplitter.c:1.5
Andreas Jung
andreas@zope.com
Wed, 17 Oct 2001 11:49:04 -0400
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndex/Splitter/UnicodeSplitter/src
In directory cvs.zope.org:/tmp/cvs-serv9077/src
Modified Files:
UnicodeSplitter.c
Log Message:
added checking for bad encoding parameters
=== Zope/lib/python/Products/PluginIndexes/TextIndex/Splitter/UnicodeSplitter/src/UnicodeSplitter.c 1.4 => 1.5 ===
Splitter_pos(Splitter *self, PyObject *args)
{
-
return Py_BuildValue("(ii)", 0,0);
}
@@ -291,19 +290,19 @@
if (! (self = PyObject_NEW(Splitter, &SplitterType))) return NULL;
if (! (PyArg_ParseTupleAndKeywords(args,keywds,"O|Os",splitter_args,&doc,&synstop,&encoding))) return NULL;
-
#ifdef DEBUG
puts("got text");
PyObject_Print(doc,stdout,0);
fflush(stdout);
#endif
-
if (PyString_Check(doc)) {
unicodedoc = PyUnicode_FromEncodedObject(doc,encoding,"strict");
- if (! unicodedoc) goto err;
-
+ if (unicodedoc ==NULL) {
+ PyErr_SetString(PyExc_UnicodeError, "Problem converting encoded string");
+ return NULL;
+ }
} else if( PyUnicode_Check(doc)) {
unicodedoc = doc;