浏览代码

Check for PyLong, for pypy.

Jelmer Vernooij 9 年之前
父节点
当前提交
65adf6bb76
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      dulwich/_objects.c

+ 2 - 2
dulwich/_objects.c

@@ -199,7 +199,7 @@ static PyObject *py_sorted_tree_items(PyObject *self, PyObject *args)
 		}
 
 		py_mode = PyTuple_GET_ITEM(value, 0);
-		if (!PyInt_Check(py_mode)) {
+		if (!PyInt_Check(py_mode) && !PyLong_Check(py_mode)) {
 			PyErr_SetString(PyExc_TypeError, "Mode is not an integral type");
 			goto error;
 		}
@@ -210,7 +210,7 @@ static PyObject *py_sorted_tree_items(PyObject *self, PyObject *args)
 			goto error;
 		}
 		qsort_entries[n].name = PyString_AS_STRING(key);
-		qsort_entries[n].mode = PyInt_AS_LONG(py_mode);
+		qsort_entries[n].mode = PyInt_AsLong(py_mode);
 
 		qsort_entries[n].tuple = PyObject_CallFunctionObjArgs(
 		                tree_entry_cls, key, py_mode, py_sha, NULL);