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

Skip to content

Commit 3daf758

Browse files
committed
Fix bug found by Coverity: don't allow NULL argument to PyUnicode_CheckExact
1 parent d364a07 commit 3daf758

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ PyObject_Unicode(PyObject *v)
402402
PyObject *func;
403403
static PyObject *unicodestr;
404404

405-
if (v == NULL)
405+
if (v == NULL) {
406406
res = PyString_FromString("<NULL>");
407-
if (PyUnicode_CheckExact(v)) {
407+
} else if (PyUnicode_CheckExact(v)) {
408408
Py_INCREF(v);
409409
return v;
410410
}

0 commit comments

Comments
 (0)