summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
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;