Mercurial > cpython-lru_cache-weakref
diff Python/errors.c @ 40548:ca295c270b1c 2.5
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__).
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Fri, 05 Jan 2007 05:28:50 +0000 |
| parents | 6ba402b60041 |
| children | 2ce229a7ba3f f3f0c697aa5b |
line wrap: on
line diff
--- a/Python/errors.c Fri Jan 05 02:09:06 2007 +0000 +++ b/Python/errors.c Fri Jan 05 05:28:50 2007 +0000 @@ -640,7 +640,8 @@ 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);
