extern int convgf(PyObject *, void *);
extern PyObject *mp_pywrap(mp *);
extern PyObject *gf_pywrap(mp *);
-extern long mphash(mp *);
+extern Py_hash_t mphash(mp *);
extern mp *mp_frompyobject(PyObject *, int);
extern PyObject *mp_topystring(mp *, int,
const char *, const char *, const char *);
return (ecpt_pywrap(ECPT_COBJ(y), &zz));
}
-static long ecpt_pyhash(PyObject *me)
+static Py_hash_t ecpt_pyhash(PyObject *me)
{
uint32 h;
ec p = EC_INIT;
return (rc);
}
-static long fe_pyhash(PyObject *me)
+static Py_hash_t fe_pyhash(PyObject *me)
{ return (mphash(FE_X(me))); }
static int fe_pycoerce(PyObject **x, PyObject **y)
G_COPY(g, x, g->g); return (ge_pywrap(me, x));
}
-static long ge_pyhash(PyObject *me)
+static Py_hash_t ge_pyhash(PyObject *me)
{
buf b;
size_t sz = GE_G(me)->noctets + 4;
return ((PyObject *)zz);
}
-long mphash(mp *x)
+Py_hash_t mphash(mp *x)
{
PyObject *l = mp_topylong(x);
- long h = PyObject_Hash(l);
+ Py_hash_t h = PyObject_Hash(l);
Py_DECREF(l); return (h);
}
-static long mp_pyhash(PyObject *me) { return (mphash(MP_X(me))); }
+static Py_hash_t mp_pyhash(PyObject *me) { return (mphash(MP_X(me))); }
static PyObject *mpmeth_jacobi(PyObject *me, PyObject *arg)
{
# define PyVarObject_HEAD_INIT(super, sz) PyObject_HEAD_INIT(super) sz,
#endif
+/* Python 3.2 changed the type of hash values, so paper over this annoying
+ * difference.
+ */
+#if PY_VERSION_HEX < 0x03020000
+ typedef long Py_hash_t;
+#endif
+
/*----- Utilities for returning values and exceptions ---------------------*/
/* Returning values. */