We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0716aa5 commit 80eb439Copy full SHA for 80eb439
Python/codecs.c
@@ -146,15 +146,14 @@ PyObject *_PyCodec_Lookup(const char *encoding)
146
PyUnicode_InternInPlace(&v);
147
148
/* First, try to lookup the name in the registry dictionary */
149
- PyObject *result = PyDict_GetItemWithError(interp->codec_search_cache, v);
+ PyObject *result;
150
+ if (PyDict_GetItemRef(interp->codec_search_cache, v, &result) < 0) {
151
+ goto onError;
152
+ }
153
if (result != NULL) {
- Py_INCREF(result);
154
Py_DECREF(v);
155
return result;
156
}
- else if (PyErr_Occurred()) {
- goto onError;
157
- }
158
159
/* Next, scan the search functions in order of registration */
160
const Py_ssize_t len = PyList_Size(interp->codec_search_path);
0 commit comments