Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 38454:631c207c3692 | 38455:1a23706139ca |
|---|---|
| 586 PyErr_Fetch(&t, &v, &tb); | 586 PyErr_Fetch(&t, &v, &tb); |
| 587 f = PySys_GetObject("stderr"); | 587 f = PySys_GetObject("stderr"); |
| 588 if (f != NULL) { | 588 if (f != NULL) { |
| 589 PyFile_WriteString("Exception ", f); | 589 PyFile_WriteString("Exception ", f); |
| 590 if (t) { | 590 if (t) { |
| 591 PyObject* moduleName; | |
| 591 char* className = PyExceptionClass_Name(t); | 592 char* className = PyExceptionClass_Name(t); |
| 592 PyObject* moduleName; | 593 |
| 593 char *dot = strrchr(className, '.'); | 594 if (className != NULL) { |
| 594 if (dot != NULL) | 595 char *dot = strrchr(className, '.'); |
| 595 className = dot+1; | 596 if (dot != NULL) |
| 597 className = dot+1; | |
| 598 } | |
| 599 | |
| 596 moduleName = PyObject_GetAttrString(t, "__module__"); | 600 moduleName = PyObject_GetAttrString(t, "__module__"); |
| 597 | |
| 598 if (moduleName == NULL) | 601 if (moduleName == NULL) |
| 599 PyFile_WriteString("<unknown>", f); | 602 PyFile_WriteString("<unknown>", f); |
| 600 else { | 603 else { |
| 601 char* modstr = PyString_AsString(moduleName); | 604 char* modstr = PyString_AsString(moduleName); |
| 602 if (modstr) | 605 if (modstr) |
