BIND 10 trac2853, updated. 3ffa4a979da3b91b0c721d931f0d9ad333f076a8 [2853] Handle exceptions from getSegmentType()

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jun 12 10:29:05 UTC 2013


The branch, trac2853 has been updated
       via  3ffa4a979da3b91b0c721d931f0d9ad333f076a8 (commit)
      from  3cc9fc1217967770551c6acb3ba8f6c6a0387864 (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 3ffa4a979da3b91b0c721d931f0d9ad333f076a8
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Jun 12 15:57:21 2013 +0530

    [2853] Handle exceptions from getSegmentType()

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

Summary of changes:
 .../isc/datasrc/configurableclientlist_inc.cc      |    2 ++
 .../isc/datasrc/configurableclientlist_python.cc   |   18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/datasrc/configurableclientlist_inc.cc b/src/lib/python/isc/datasrc/configurableclientlist_inc.cc
index eee3a62..69f6be5 100644
--- a/src/lib/python/isc/datasrc/configurableclientlist_inc.cc
+++ b/src/lib/python/isc/datasrc/configurableclientlist_inc.cc
@@ -92,6 +92,8 @@ The tuples contain (name, segment_type, segment_state):\n\
   name              The name of the data source.\n\
   segment_type      A string indicating the type of memory segment in use.\n\
   segment_state     The state of the memory segment.\n\
+\n\
+If segment_state is SEGMENT_UNUSED, None is returned for the segment_type.\n\
 ";
 
 const char* const ConfigurableClientList_find_doc = "\
diff --git a/src/lib/python/isc/datasrc/configurableclientlist_python.cc b/src/lib/python/isc/datasrc/configurableclientlist_python.cc
index 73ec491..9c3f1ab 100644
--- a/src/lib/python/isc/datasrc/configurableclientlist_python.cc
+++ b/src/lib/python/isc/datasrc/configurableclientlist_python.cc
@@ -210,10 +210,24 @@ ConfigurableClientList_getStatus(PyObject* po_self, PyObject*) {
         }
 
         for (size_t i = 0; i < status.size(); ++i) {
-            PyObject *tup = Py_BuildValue("(ssI)",
+            PyObject *segment_type = NULL;
+            try {
+                segment_type = Py_BuildValue(
+                    "s", status[i].getSegmentType().c_str());
+            } catch (const isc::InvalidOperation& e) {
+                Py_INCREF(Py_None);
+                segment_type = Py_None;
+            }
+
+            PyObject *tup = Py_BuildValue("(sOI)",
                                           status[i].getName().c_str(),
-                                          status[i].getSegmentType().c_str(),
+                                          segment_type,
                                           status[i].getSegmentState());
+            if (segment_type) {
+                // The Py_BuildValue() above increments its refcount,
+                // so we drop our reference.
+                Py_DECREF(segment_type);
+            }
             if (!tup) {
                 Py_DECREF(slist);
                 return (NULL);



More information about the bind10-changes mailing list