Fix bug found by Coverity: don't allow NULL argument to PyUnicode_CheckExact

This commit is contained in:
Georg Brandl 2006-03-13 22:22:11 +00:00
parent d364a07517
commit 3daf75878d

View File

@ -402,9 +402,9 @@ PyObject_Unicode(PyObject *v)
PyObject *func;
static PyObject *unicodestr;
if (v == NULL)
if (v == NULL) {
res = PyString_FromString("<NULL>");
if (PyUnicode_CheckExact(v)) {
} else if (PyUnicode_CheckExact(v)) {
Py_INCREF(v);
return v;
}