Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PyObject *normalizestring(const char *string)

PyObject *_PyCodec_Lookup(const char *encoding)
{
PyObject *result, *v;
PyObject *result;
Py_ssize_t i, len;

if (encoding == NULL) {
Expand All @@ -114,7 +114,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
/* Convert the encoding to a normalized Python string: all
characters are converted to lower case, spaces and hyphens are
replaced with underscores. */
v = normalizestring(encoding);
PyObject *v = normalizestring(encoding);
if (v == NULL)
goto onError;
PyUnicode_InternInPlace(&v);
Expand Down Expand Up @@ -175,9 +175,11 @@ PyObject *_PyCodec_Lookup(const char *encoding)
Py_DECREF(result);
goto onError;
}
Py_DECREF(v);
return result;

onError:
Py_DECREF(v);
return NULL;
}

Expand Down