BIND 10 master, updated. 3da2b4dd513ce1108f30a2901bdbab9049845d7e [master] use Py_hash_t for return value of tp_hash, and define it for old vers.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jun 6 19:01:04 UTC 2012


The branch, master has been updated
       via  3da2b4dd513ce1108f30a2901bdbab9049845d7e (commit)
      from  45ea2c37d6f00d7f0cfe2e342a0a2907c032dc54 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3da2b4dd513ce1108f30a2901bdbab9049845d7e
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Jun 6 11:58:44 2012 -0700

    [master] use Py_hash_t for return value of tp_hash, and define it for old vers.
    
    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.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/python/name_python.cc    |    4 ++--
 src/lib/dns/python/pydnspp_common.h  |    5 +++++
 src/lib/dns/python/rrclass_python.cc |    4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/python/name_python.cc b/src/lib/dns/python/name_python.cc
index 6758d0e..c24d24d 100644
--- a/src/lib/dns/python/name_python.cc
+++ b/src/lib/dns/python/name_python.cc
@@ -115,7 +115,7 @@ PyObject* Name_reverse(s_Name* self);
 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,
@@ -520,7 +520,7 @@ Name_isWildCard(s_Name* self) {
     }
 }
 
-long
+Py_hash_t
 Name_hash(PyObject* pyself) {
     s_Name* const self = static_cast<s_Name*>(pyself);
     return (LabelSequence(*self->cppobj).getHash(false));
diff --git a/src/lib/dns/python/pydnspp_common.h b/src/lib/dns/python/pydnspp_common.h
index 8092b08..e9e9359 100644
--- a/src/lib/dns/python/pydnspp_common.h
+++ b/src/lib/dns/python/pydnspp_common.h
@@ -43,6 +43,11 @@ extern PyObject* po_DNSMessageBADVERS;
 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
diff --git a/src/lib/dns/python/rrclass_python.cc b/src/lib/dns/python/rrclass_python.cc
index 2c3dae6..b94dc02 100644
--- a/src/lib/dns/python/rrclass_python.cc
+++ b/src/lib/dns/python/rrclass_python.cc
@@ -52,7 +52,7 @@ PyObject* RRClass_str(PyObject* self);
 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);
@@ -265,7 +265,7 @@ PyObject* RRClass_ANY(s_RRClass*) {
     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());



More information about the bind10-changes mailing list