The previous code (using long) caused build failure on Solaris.
Python 3.2 changed the return type of internal hash API:
http://docs.python.org/py3k/c-api/object.html#PyObject_Hash
from long to Py_hash_t and solaris seems to be more strict about the
difference of these types.
this patch is a bit ad hoc (define it for older python versions
referring to PY_MINOR_VERSION) but I thought that's the best way for
an urgent care fix. I'll create a ticket for a cleaner solution.
PyObject* Name_concatenate(s_Name* self, PyObject* args);
PyObject* Name_downcase(s_Name* self);
PyObject* Name_isWildCard(s_Name* self);
-long Name_hash(PyObject* py_self);
+Py_hash_t Name_hash(PyObject* py_self);
PyMethodDef Name_methods[] = {
{ "at", reinterpret_cast<PyCFunction>(Name_at), METH_VARARGS,
}
}
-long
+Py_hash_t
Name_hash(PyObject* pyself) {
s_Name* const self = static_cast<s_Name*>(pyself);
return (LabelSequence(*self->cppobj).getHash(false));
int readDataFromSequence(uint8_t *data, size_t len, PyObject* sequence);
int addClassVariable(PyTypeObject& c, const char* name, PyObject* obj);
+
+// Short term workaround for unifying the return type of tp_hash
+#if PY_MINOR_VERSION < 2
+typedef long Py_hash_t;
+#endif
} // namespace python
} // namespace dns
} // namespace isc
PyObject* RRClass_toWire(s_RRClass* self, PyObject* args);
PyObject* RRClass_getCode(s_RRClass* self);
PyObject* RRClass_richcmp(s_RRClass* self, s_RRClass* other, int op);
-long RRClass_hash(PyObject* pyself);
+Py_hash_t RRClass_hash(PyObject* pyself);
// Static function for direct class creation
PyObject* RRClass_IN(s_RRClass *self);
return (RRClass_createStatic(RRClass::ANY()));
}
-long
+Py_hash_t
RRClass_hash(PyObject* pyself) {
s_RRClass* const self = static_cast<s_RRClass*>(pyself);
return (self->cppobj->getCode());