summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-05-28 10:41:29 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-05-28 10:41:29 (GMT)
commit5e9d6cfbda8f968a849d5235b75b32e7175ad8fd (patch)
treea7a05e18789712e4ad961e98c8df0879b899c1cd /Python/errors.c
parenta37722cc423524ac9a35d6432cf3866d9a8d12bd (diff)
downloadcpython-5e9d6cfbda8f968a849d5235b75b32e7175ad8fd.zip
cpython-5e9d6cfbda8f968a849d5235b75b32e7175ad8fd.tar.gz
cpython-5e9d6cfbda8f968a849d5235b75b32e7175ad8fd.tar.bz2
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/errors.c b/Python/errors.c
index f7a1c08..a40f073 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -588,13 +588,16 @@ PyErr_WriteUnraisable(PyObject *obj)
if (f != NULL) {
PyFile_WriteString("Exception ", f);
if (t) {
- char* className = PyExceptionClass_Name(t);
PyObject* moduleName;
- char *dot = strrchr(className, '.');
- if (dot != NULL)
- className = dot+1;
- moduleName = PyObject_GetAttrString(t, "__module__");
+ char* className = PyExceptionClass_Name(t);
+ 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 {