Commit c62f3255 authored by Keith Bennett's avatar Keith Bennett

Handle UTF8 conversion errors

parent 3dc4e086
......@@ -50,7 +50,15 @@
#define PyInt_FromLong PyLong_FromLong
#define PyASCII_FromString PyString_FromString
#else
#define PyASCII_FromString PyUnicode_FromString
PyObject *PyASCII_FromString(char *str)
{
PyObject *ob = PyUnicode_FromString(str);
if (ob == NULL) {
PyErr_Clear();
ob = PyUnicode_FromString("");
}
return ob;
}
#endif
#ifndef NPY_ARRAY_F_CONTIGUOUS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment