comparison Python/pythonrun.c @ 70402:2e72fcfb2527

print_exception(): handle correctly PyObject_GetAttrString() failure Bug found by the Clang Static Analyzer.
author Victor Stinner <victor.stinner@haypocalc.com>
date Thu, 26 May 2011 14:25:13 +0200
parents 94e3c44b0662
children 7ce685cda0ae
comparison
equal deleted inserted replaced
70401:8b819c982b36 70402:2e72fcfb2527
1591 } 1591 }
1592 1592
1593 moduleName = PyObject_GetAttrString(type, "__module__"); 1593 moduleName = PyObject_GetAttrString(type, "__module__");
1594 if (moduleName == NULL || !PyUnicode_Check(moduleName)) 1594 if (moduleName == NULL || !PyUnicode_Check(moduleName))
1595 { 1595 {
1596 Py_DECREF(moduleName); 1596 Py_XDECREF(moduleName);
1597 err = PyFile_WriteString("<unknown>", f); 1597 err = PyFile_WriteString("<unknown>", f);
1598 } 1598 }
1599 else { 1599 else {
1600 char* modstr = _PyUnicode_AsString(moduleName); 1600 char* modstr = _PyUnicode_AsString(moduleName);
1601 if (modstr && strcmp(modstr, "builtins")) 1601 if (modstr && strcmp(modstr, "builtins"))