Skip to content

Commit

Permalink
Use Py_hash_t as return type of hash functions (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesjer authored Jan 29, 2024
1 parent 26725ac commit 48f48f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions python/polypyPolynomial3.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Polynomial_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject*
Polynomial_richcompare(PyObject* self, PyObject* args, int op);

static long
static Py_hash_t
Polynomial_hash(PyObject* self);

static PyObject*
Expand Down Expand Up @@ -407,10 +407,10 @@ Polynomial_richcompare(PyObject* self, PyObject* other, int op) {
return result;
}

static long
static Py_hash_t
Polynomial_hash(PyObject* self) {
Polynomial* p = (Polynomial*) self;
long hash = lp_polynomial_hash(p->p);
Py_hash_t hash = lp_polynomial_hash(p->p);
if (hash == -1) {
// value -1 should not be returned as a normal return value
hash = 0;
Expand Down
6 changes: 3 additions & 3 deletions python/polypyValue3.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Value_richcompare(PyObject* self, PyObject* other, int op);
static PyObject*
Value_str(PyObject* self);

static long
static Py_hash_t
Value_hash(PyObject* self);

static PyObject*
Expand Down Expand Up @@ -304,10 +304,10 @@ static PyObject* Value_str(PyObject* self) {
return pystr;
}

static long
static Py_hash_t
Value_hash(PyObject* self) {
Value* v = (Value*) self;
long hash = lp_value_hash(&v->v);
Py_hash_t hash = lp_value_hash(&v->v);
if (hash == -1) {
// value -1 should not be returned as a normal return value
hash = 0;
Expand Down
4 changes: 2 additions & 2 deletions python/polypyVariable3.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Variable_str(PyObject* self);
static PyObject*
Variable_repr(PyObject* self);

static long
static Py_hash_t
Variable_hash(PyObject* self);

static PyObject *
Expand Down Expand Up @@ -227,7 +227,7 @@ static PyObject* Variable_repr(PyObject* self) {
return str;
}

static long Variable_hash(PyObject* self) {
static Py_hash_t Variable_hash(PyObject* self) {
Variable* x = (Variable*) self;
return x->x;
}
Expand Down

0 comments on commit 48f48f9

Please sign in to comment.