[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.75,2.76
Fredrik Lundh
effbot@users.sourceforge.net
Sat, 20 Jan 2001 03:15:27 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv16317/Objects
Modified Files:
unicodeobject.c
Log Message:
Better error message if ucnhash cannot be found (obscure attribute
errors aren't that helpful), or doesn't contain what's expected from
it. Also tweaked the test script so it compiles even if ucnhash is
missing.
Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.75
retrieving revision 2.76
diff -C2 -r2.75 -r2.76
*** unicodeobject.c 2001/01/19 09:45:02 2.75
--- unicodeobject.c 2001/01/20 11:15:24 2.76
***************
*** 1241,1253 ****
mod = PyImport_ImportModule("ucnhash");
if (mod == NULL)
! goto onError;
v = PyObject_GetAttrString(mod,"Unicode_Names_CAPI");
Py_DECREF(mod);
if (v == NULL)
! goto onError;
unicode_names = PyCObject_AsVoidPtr(v);
Py_DECREF(v);
if (unicode_names == NULL)
! goto onError;
}
--- 1241,1253 ----
mod = PyImport_ImportModule("ucnhash");
if (mod == NULL)
! goto ucnhashError;
v = PyObject_GetAttrString(mod,"Unicode_Names_CAPI");
Py_DECREF(mod);
if (v == NULL)
! goto ucnhashError;
unicode_names = PyCObject_AsVoidPtr(v);
Py_DECREF(v);
if (unicode_names == NULL)
! goto ucnhashError;
}
***************
*** 1312,1315 ****
--- 1312,1320 ----
return (PyObject *)v;
+ ucnhashError:
+ PyErr_SetString(PyExc_UnicodeError,
+ "\\N escapes not supported (can't load ucnhash module)");
+ return NULL;
+
onError:
Py_XDECREF(v);