summaryrefslogtreecommitdiff
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-11 04:58:26 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-11 04:58:26 +0000
commit5741327eab7e1fad90f9f6904b86c15253253b1c (patch)
tree55632958811abc5d6c7083d17a82c6528eea62f6 /Python/codecs.c
parentcbdfaf7ee0b6d10150456f9f713acc64c5b857cc (diff)
downloadcpython-5741327eab7e1fad90f9f6904b86c15253253b1c.tar.gz
Handle error
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 3aa1f386e7..464fffc150 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;