summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-11 04:58:26 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-11 04:58:26 (GMT)
commit9edcc2e2fd6196886f9e94407833f14c2a854c22 (patch)
treeb49782030c81a51551afb4fcfe1d13436626bdf5 /Python
parent7378df78225e9dcd3da7831c81f52f2af36692fc (diff)
downloadcpython-9edcc2e2fd6196886f9e94407833f14c2a854c22.zip
cpython-9edcc2e2fd6196886f9e94407833f14c2a854c22.tar.gz
cpython-9edcc2e2fd6196886f9e94407833f14c2a854c22.tar.bz2
Handle error
Diffstat (limited to 'Python')
-rw-r--r--Python/codecs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 3aa1f38..464fffc 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -167,7 +167,10 @@ PyObject *_PyCodec_Lookup(const char *encoding)
}
/* Cache and return the result */
- PyDict_SetItem(interp->codec_search_cache, v, result);
+ if (PyDict_SetItem(interp->codec_search_cache, v, result) < 0) {
+ Py_DECREF(result);
+ goto onError;
+ }
Py_DECREF(args);
return result;