Mercurial > cpython-lru_cache-weakref
diff Python/codecs.c @ 37252:52debbc3cc08 2.4
Backport of compile.c part of r41531 (neal.norwitz, 2005-11-24):
Fix a ref leak.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 27 Mar 2006 21:47:54 +0000 |
| parents | 201986d6d9d6 |
| children | 7fdc639bc5b4 |
line wrap: on
line diff
--- a/Python/codecs.c Mon Mar 27 21:38:32 2006 +0000 +++ b/Python/codecs.c Mon Mar 27 21:47:54 2006 +0000 @@ -36,8 +36,7 @@ goto onError; } if (!PyCallable_Check(search_function)) { - PyErr_SetString(PyExc_TypeError, - "argument must be callable"); + PyErr_SetString(PyExc_TypeError, "argument must be callable"); goto onError; } return PyList_Append(interp->codec_search_path, search_function); @@ -305,7 +304,7 @@ const char *errors) { PyObject *encoder = NULL; - PyObject *args = NULL, *result; + PyObject *args = NULL, *result = NULL; PyObject *v; encoder = PyCodec_Encoder(encoding); @@ -336,6 +335,7 @@ return v; onError: + Py_XDECREF(result); Py_XDECREF(args); Py_XDECREF(encoder); return NULL;
