Mercurial > cpython-lru_cache-weakref
diff Python/errors.c @ 38455:1a23706139ca legacy-trunk
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Sun, 28 May 2006 10:41:29 +0000 |
| parents | 4c0823f0a0a1 |
| children | 5531955993ed |
line wrap: on
line diff
--- a/Python/errors.c Sun May 28 01:52:38 2006 +0000 +++ b/Python/errors.c Sun May 28 10:41:29 2006 +0000 @@ -588,13 +588,16 @@ if (f != NULL) { PyFile_WriteString("Exception ", f); if (t) { + PyObject* moduleName; char* className = PyExceptionClass_Name(t); - PyObject* moduleName; - char *dot = strrchr(className, '.'); - if (dot != NULL) - className = dot+1; + + if (className != NULL) { + char *dot = strrchr(className, '.'); + if (dot != NULL) + className = dot+1; + } + moduleName = PyObject_GetAttrString(t, "__module__"); - if (moduleName == NULL) PyFile_WriteString("<unknown>", f); else {
