On 17-Mar-2000, Marc-Andre Lemburg said:

Attached you find an update of the Unicode implementation.

    The patch is against the current CVS version. I would appreciate
    if someone with CVS checkin permissions could check the changes
    in.

    The patch contains all bugs and patches sent this week and also
    fixes a leak in the codecs code and a bug in the free list code
    for Unicode objects (which only shows up when compiling Python
    with Py_DEBUG; thanks to MarkH for spotting this one).
This commit is contained in:
Barry Warsaw 2000-03-20 16:36:48 +00:00
parent abc411bac8
commit 51ac58039f
9 changed files with 61 additions and 39 deletions

View file

@ -93,9 +93,14 @@ PyObject *lowercasestring(const char *string)
PyObject *_PyCodec_Lookup(const char *encoding)
{
PyObject *result, *args = NULL, *v;
PyObject *result, *args = NULL, *v = NULL;
int i, len;
if (_PyCodec_SearchCache == NULL || _PyCodec_SearchPath == NULL) {
PyErr_SetString(PyExc_SystemError,
"codec module not properly initialized");
goto onError;
}
if (!import_encodings_called)
import_encodings();
@ -109,6 +114,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
result = PyDict_GetItem(_PyCodec_SearchCache, v);
if (result != NULL) {
Py_INCREF(result);
Py_DECREF(v);
return result;
}
@ -121,6 +127,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
if (args == NULL)
goto onError;
PyTuple_SET_ITEM(args,0,v);
v = NULL;
for (i = 0; i < len; i++) {
PyObject *func;
@ -146,7 +153,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
if (i == len) {
/* XXX Perhaps we should cache misses too ? */
PyErr_SetString(PyExc_LookupError,
"unkown encoding");
"unknown encoding");
goto onError;
}
@ -156,6 +163,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
return result;
onError:
Py_XDECREF(v);
Py_XDECREF(args);
return NULL;
}
@ -378,5 +386,7 @@ void _PyCodecRegistry_Init()
void _PyCodecRegistry_Fini()
{
Py_XDECREF(_PyCodec_SearchPath);
_PyCodec_SearchPath = NULL;
Py_XDECREF(_PyCodec_SearchCache);
_PyCodec_SearchCache = NULL;
}