mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Issue #8766: Initialize _warnings module before importing the first module.
Fix a crash if an empty directory called "encodings" exists in sys.path.
This commit is contained in:
parent
5b08b4d230
commit
7d79b8b771
4 changed files with 36 additions and 13 deletions
|
@ -116,7 +116,7 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno,
|
|||
_filters = warnings_filters;
|
||||
}
|
||||
|
||||
if (!PyList_Check(_filters)) {
|
||||
if (_filters == NULL || !PyList_Check(_filters)) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
MODULE_NAME ".filters must be a list");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue