From: Mukund Sivaraman Date: Sun, 30 Jun 2013 18:40:57 +0000 (+0530) Subject: [master] Fix Python API compatibility issue with CPython < 3.3.0 X-Git-Tag: bind10-1.2.0beta1-release~372 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed780cbba41428341c5956ff5b032d829d059cab;p=thirdparty%2Fkea.git [master] Fix Python API compatibility issue with CPython < 3.3.0 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). --- diff --git a/src/lib/python/isc/datasrc/configurableclientlist_python.cc b/src/lib/python/isc/datasrc/configurableclientlist_python.cc index 5e56b18c94..a8c6d5feb3 100644 --- a/src/lib/python/isc/datasrc/configurableclientlist_python.cc +++ b/src/lib/python/isc/datasrc/configurableclientlist_python.cc @@ -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);