浏览代码

Fix unnecessary incref of Py_False.

Jelmer Vernooij 11 年之前
父节点
当前提交
3cd646b2bf
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      dulwich/_diff_tree.c

+ 1 - 1
dulwich/_diff_tree.c

@@ -260,6 +260,7 @@ static PyObject *py_is_tree(PyObject *self, PyObject *args)
 
 	if (mode == Py_None) {
 		result = Py_False;
+		Py_INCREF(result);
 	} else {
 		lmode = PyInt_AsLong(mode);
 		if (lmode == -1 && PyErr_Occurred()) {
@@ -268,7 +269,6 @@ static PyObject *py_is_tree(PyObject *self, PyObject *args)
 		}
 		result = PyBool_FromLong(S_ISDIR((mode_t)lmode));
 	}
-	Py_INCREF(result);
 	Py_DECREF(mode);
 	return result;
 }