Skip to content

Commit 8702071

Browse files
author
neal.norwitz
committed
Handle error
git-svn-id: http://svn.python.org/projects/python/branches/py3k@56912 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 0cdc644 commit 8702071

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Python/codecs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ PyObject *_PyCodec_Lookup(const char *encoding)
167167
}
168168

169169
/* Cache and return the result */
170-
PyDict_SetItem(interp->codec_search_cache, v, result);
170+
if (PyDict_SetItem(interp->codec_search_cache, v, result) < 0) {
171+
Py_DECREF(result);
172+
goto onError;
173+
}
171174
Py_DECREF(args);
172175
return result;
173176

0 commit comments

Comments
 (0)