diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-01-05 05:28:50 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-01-05 05:28:50 +0000 |
commit | 7770f9f6d260548fbed4059c81a1727dc098e5b5 (patch) | |
tree | e08b808bf657a0053f970bea57452d0df49241a2 /Python/errors.c | |
parent | 1a050f5f52c88c28f7d00b5728e3ede548c8cb7e (diff) | |
download | cpython-git-7770f9f6d260548fbed4059c81a1727dc098e5b5.tar.gz |
Backport:
Prevent crash on shutdown which can occur if we are finalizing
and the module dict has been cleared already and some object
raises a warning (like in a __del__).
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 66a734eb15..f31f025112 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -640,7 +640,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); |