Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a possible crash on interpreter startup when codecs are not
initialized.
5 changes: 4 additions & 1 deletion Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ PyObject *_PyCodec_Lookup(const char *encoding)
}

PyInterpreterState *interp = _PyInterpreterState_GET();
assert(interp->codecs.initialized);
if (!interp->codecs.initialized) {
PyErr_SetString(PyExc_SystemError, "Codecs are not initialized");
return NULL;
}

/* Convert the encoding to a normalized Python string: all
ASCII letters are converted to lower case, spaces are
Expand Down
Loading