Browse Source

[trac2116/master] don't set pyerr string in Name.split() on success.

JINMEI Tatuya 12 years ago
parent
commit
a51a74fa7f
1 changed files with 5 additions and 6 deletions
  1. 5 6
      src/lib/dns/python/name_python.cc

+ 5 - 6
src/lib/dns/python/name_python.cc

@@ -386,7 +386,7 @@ Name_split(s_Name* self, PyObject* args) {
             ret->cppobj = NULL;
             ret->cppobj = NULL;
             try {
             try {
                 ret->cppobj = new Name(self->cppobj->split(first, n));
                 ret->cppobj = new Name(self->cppobj->split(first, n));
-            } catch(const isc::OutOfRange& oor) {
+            } catch (const isc::OutOfRange& oor) {
                 PyErr_SetString(PyExc_IndexError, oor.what());
                 PyErr_SetString(PyExc_IndexError, oor.what());
                 ret->cppobj = NULL;
                 ret->cppobj = NULL;
             }
             }
@@ -408,7 +408,7 @@ Name_split(s_Name* self, PyObject* args) {
             ret->cppobj = NULL;
             ret->cppobj = NULL;
             try {
             try {
                 ret->cppobj = new Name(self->cppobj->split(n));
                 ret->cppobj = new Name(self->cppobj->split(n));
-            } catch(const isc::OutOfRange& oor) {
+            } catch (const isc::OutOfRange& oor) {
                 PyErr_SetString(PyExc_IndexError, oor.what());
                 PyErr_SetString(PyExc_IndexError, oor.what());
                 ret->cppobj = NULL;
                 ret->cppobj = NULL;
             }
             }
@@ -417,11 +417,10 @@ Name_split(s_Name* self, PyObject* args) {
                 return (NULL);
                 return (NULL);
             }
             }
         }
         }
+    } else {
+        PyErr_Clear();
+        PyErr_SetString(PyExc_TypeError, "No valid type in split argument");
     }
     }
-
-    PyErr_Clear();
-    PyErr_SetString(PyExc_TypeError,
-                    "No valid type in split argument");
     return (ret);
     return (ret);
 }
 }