From fab618e011e19610bb9be31037465ff1cc70063b Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 26 Jan 2011 20:21:00 +0000 Subject: Change order of Py_check calls in typemap. It turns out that PyInt_Check returns 'True' for booleans. The order of the checks is now from most specific to least. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1063862 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/swig_python_typemaps.i | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cpp') diff --git a/cpp/bindings/swig_python_typemaps.i b/cpp/bindings/swig_python_typemaps.i index a233641940..b69784a6de 100644 --- a/cpp/bindings/swig_python_typemaps.i +++ b/cpp/bindings/swig_python_typemaps.i @@ -32,11 +32,11 @@ typedef int Py_ssize_t; void PyToList(PyObject*, qpid::types::Variant::List*); qpid::types::Variant PyToVariant(PyObject* value) { + if (PyBool_Check(value)) return qpid::types::Variant(bool(PyInt_AS_LONG(value) ? true : false)); if (PyFloat_Check(value)) return qpid::types::Variant(PyFloat_AS_DOUBLE(value)); - if (PyString_Check(value)) return qpid::types::Variant(std::string(PyString_AS_STRING(value))); if (PyInt_Check(value)) return qpid::types::Variant(int64_t(PyInt_AS_LONG(value))); if (PyLong_Check(value)) return qpid::types::Variant(int64_t(PyLong_AsLongLong(value))); - if (PyBool_Check(value)) return qpid::types::Variant(bool(PyInt_AS_LONG(value) ? true : false)); + if (PyString_Check(value)) return qpid::types::Variant(std::string(PyString_AS_STRING(value))); if (PyDict_Check(value)) { qpid::types::Variant::Map map; PyToMap(value, &map); -- cgit v1.2.1