Skip to content

Commit

Permalink
Use Py_hash_t type in Python3; should fix Python3 hash tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed May 1, 2017
1 parent 51a89e7 commit f3f6288
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dulwich/_diff_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
typedef unsigned short mode_t;
#endif

#if PY_MAJOR_VERSION < 3
typedef long Py_hash_t;
#endif

#if PY_MAJOR_VERSION >= 3
#define PyInt_FromLong PyLong_FromLong
#define PyInt_AsLong PyLong_AsLong
Expand Down Expand Up @@ -292,11 +296,11 @@ static PyObject *py_is_tree(PyObject *self, PyObject *args)
return result;
}

static int add_hash(PyObject *get, PyObject *set, char *str, int n)
static Py_hash_t add_hash(PyObject *get, PyObject *set, char *str, int n)
{
PyObject *str_obj = NULL, *hash_obj = NULL, *value = NULL,
*set_value = NULL;
long hash;
Py_hash_t hash;

/* It would be nice to hash without copying str into a PyString, but that
* isn't exposed by the API. */
Expand Down

0 comments on commit f3f6288

Please sign in to comment.