diff Python/codecs.c @ 42534:5f9e79d1e158

Handle error
author Neal Norwitz <nnorwitz@gmail.com>
date Sat, 11 Aug 2007 04:58:26 +0000
parents 3473a685e5e7
children dd03aa741f56
line wrap: on
line diff
--- a/Python/codecs.c	Sat Aug 11 04:20:51 2007 +0000
+++ b/Python/codecs.c	Sat Aug 11 04:58:26 2007 +0000
@@ -167,7 +167,10 @@
     }
 
     /* 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;