Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d78550

Browse files
committed
Address an coverity issue. Coverity was complaining about a line that's fine,
but an earlier line checked for v != NULL unnecessarily.
1 parent ec73cd4 commit 9d78550

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Python/pythonrun.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ PyErr_PrintEx(int set_sys_last_vars)
10261026
PyErr_NormalizeException(&exception, &v, &tb);
10271027
if (exception == NULL)
10281028
return;
1029+
/* Now we know v != NULL too */
10291030
if (set_sys_last_vars) {
10301031
PySys_SetObject("last_type", exception);
10311032
PySys_SetObject("last_value", v);
@@ -1034,7 +1035,7 @@ PyErr_PrintEx(int set_sys_last_vars)
10341035
hook = PySys_GetObject("excepthook");
10351036
if (hook) {
10361037
PyObject *args = PyTuple_Pack(3,
1037-
exception, v ? v : Py_None, tb ? tb : Py_None);
1038+
exception, v, tb ? tb : Py_None);
10381039
PyObject *result = PyEval_CallObject(hook, args);
10391040
if (result == NULL) {
10401041
PyObject *exception2, *v2, *tb2;

0 commit comments

Comments
 (0)