]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Fix Python API compatibility issue with CPython < 3.3.0
authorMukund Sivaraman <muks@isc.org>
Sun, 30 Jun 2013 18:40:57 +0000 (00:10 +0530)
committerMukund Sivaraman <muks@isc.org>
Sun, 30 Jun 2013 18:41:03 +0000 (00:11 +0530)
The 'p' format for booleans is not available before Python 3.3 API. So
we use the previously used fallback in these cases ('i' for C int).

src/lib/python/isc/datasrc/configurableclientlist_python.cc

index 5e56b18c943faa87bc15a9b1e1c31b18d1e9d835..a8c6d5feb3359ec0ce1ddd067292b82c36f2fd9b 100644 (file)
@@ -165,8 +165,15 @@ ConfigurableClientList_getCachedZoneWriter(PyObject* po_self, PyObject* args) {
         PyObject* name_obj;
         int catch_load_error;
         const char* datasrc_name_p = "";
+#if (PY_VERSION_HEX >= 0x030300f0)
+        // The 'p' specifier for predicate (boolean) is available from
+        // Python 3.3 (final) only.
         if (PyArg_ParseTuple(args, "O!p|s", &isc::dns::python::name_type,
                              &name_obj, &catch_load_error, &datasrc_name_p)) {
+#else
+        if (PyArg_ParseTuple(args, "O!i|s", &isc::dns::python::name_type,
+                             &name_obj, &catch_load_error, &datasrc_name_p)) {
+#endif
             const isc::dns::Name&
                 name(isc::dns::python::PyName_ToName(name_obj));
             const std::string datasrc_name(datasrc_name_p);