[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.76,2.77
Fredrik Lundh
effbot@users.sourceforge.net
Tue, 23 Jan 2001 23:59:13 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv18280/Objects
Modified Files:
unicodeobject.c
Log Message:
Move uchhash functionality into unicodedata (after the recent
crop of changes, the files are small enough to do this). Also
adds "name" and "lookup" functions to unicodedata.
Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.76
retrieving revision 2.77
diff -C2 -r2.76 -r2.77
*** unicodeobject.c 2001/01/20 11:15:24 2.76
--- unicodeobject.c 2001/01/24 07:59:11 2.77
***************
*** 1104,1108 ****
}
! static _PyUnicode_Name_CAPI *unicode_names = NULL;
PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
--- 1104,1108 ----
}
! static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL;
PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
***************
*** 1237,1252 ****
* make sure we've imported the hash table data...
*/
! if (unicode_names == NULL) {
PyObject *mod = 0, *v = 0;
! 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;
}
--- 1237,1252 ----
* make sure we've imported the hash table data...
*/
! if (ucnhash_CAPI == NULL) {
PyObject *mod = 0, *v = 0;
! mod = PyImport_ImportModule("unicodedata");
if (mod == NULL)
goto ucnhashError;
! v = PyObject_GetAttrString(mod,"ucnhash_CAPI");
Py_DECREF(mod);
if (v == NULL)
goto ucnhashError;
! ucnhash_CAPI = PyCObject_AsVoidPtr(v);
Py_DECREF(v);
! if (ucnhash_CAPI == NULL)
goto ucnhashError;
}
***************
*** 1260,1264 ****
endBrace++;
if (endBrace != end && *endBrace == '}') {
! if (!unicode_names->getcode(start, endBrace-start, &chr)) {
if (unicodeescape_decoding_error(
&s, &x, errors,
--- 1260,1264 ----
endBrace++;
if (endBrace != end && *endBrace == '}') {
! if (!ucnhash_CAPI->getcode(start, endBrace-start, &chr)) {
if (unicodeescape_decoding_error(
&s, &x, errors,
***************
*** 1313,1318 ****
ucnhashError:
! PyErr_SetString(PyExc_UnicodeError,
! "\\N escapes not supported (can't load ucnhash module)");
return NULL;
--- 1313,1320 ----
ucnhashError:
! PyErr_SetString(
! PyExc_UnicodeError,
! "\\N escapes not supported (can't load unicodedata module)"
! );
return NULL;