diff options
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c index 28c1ea5..0e565c1 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -649,7 +649,8 @@ PyErr_WarnEx(PyObject *category, const char *message, Py_ssize_t stack_level) if (warnings_module != NULL) { dict = PyModule_GetDict(warnings_module); - func = PyDict_GetItemString(dict, "warn"); + if (dict != NULL) + func = PyDict_GetItemString(dict, "warn"); } if (func == NULL) { PySys_WriteStderr("warning: %s\n", message); |