[Python-checkins] CVS: python/dist/src/Python codecs.c,2.2,2.3
Guido van Rossum
python-dev@python.org
Fri, 24 Mar 2000 15:52:26 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Python
In directory eric:/projects/python/develop/guido/src/Python
Modified Files:
codecs.c
Log Message:
Marc-Andre Lemburg:
Andy Robinson noted a core dump in the codecs.c file. This
was introduced by my latest patch which fixed a memory leak
in codecs.c. The bug causes all successful codec lookups to fail.
Index: codecs.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/codecs.c,v
retrieving revision 2.2
retrieving revision 2.3
diff -C2 -r2.2 -r2.3
*** codecs.c 2000/03/20 16:36:48 2.2
--- codecs.c 2000/03/24 20:52:23 2.3
***************
*** 94,98 ****
PyObject *_PyCodec_Lookup(const char *encoding)
{
! PyObject *result, *args = NULL, *v = NULL;
int i, len;
--- 94,98 ----
PyObject *_PyCodec_Lookup(const char *encoding)
{
! PyObject *result, *args = NULL, *v;
int i, len;
***************
*** 120,132 ****
/* Next, scan the search functions in order of registration */
- len = PyList_Size(_PyCodec_SearchPath);
- if (len < 0)
- goto onError;
-
args = PyTuple_New(1);
if (args == NULL)
goto onError;
PyTuple_SET_ITEM(args,0,v);
! v = NULL;
for (i = 0; i < len; i++) {
--- 120,131 ----
/* Next, scan the search functions in order of registration */
args = PyTuple_New(1);
if (args == NULL)
goto onError;
PyTuple_SET_ITEM(args,0,v);
!
! len = PyList_Size(_PyCodec_SearchPath);
! if (len < 0)
! goto onError;
for (i = 0; i < len; i++) {
***************
*** 136,140 ****
if (func == NULL)
goto onError;
! result = PyEval_CallObject(func,args);
if (result == NULL)
goto onError;
--- 135,139 ----
if (func == NULL)
goto onError;
! result = PyEval_CallObject(func, args);
if (result == NULL)
goto onError;
***************
*** 164,168 ****
onError:
- Py_XDECREF(v);
Py_XDECREF(args);
return NULL;
--- 163,166 ----