diff --git a/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp b/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp index ee36ac1943bb83ea04e9b4bf1f1ad1cd7215b980..27cde8ecbc1ff9bf1d46cf9e60961c58c9b3f992 100644 --- a/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp +++ b/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp @@ -145,19 +145,28 @@ bool AlgorithmAdapter<BaseAlgorithm>::isRunning() const { return SuperClass::isRunning(); } else { Environment::GlobalInterpreterLock gil; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wparentheses-equality" +#endif PyObject *result = PyObject_CallObject(m_isRunningObj, nullptr); if (PyErr_Occurred()) throw Environment::PythonException(); if (PyBool_Check(result)) { + #if PY_MAJOR_VERSION >= 3 return static_cast<bool>(PyLong_AsLong(result)); #else return static_cast<bool>(PyInt_AsLong(result)); #endif + } else throw std::runtime_error( "Algorithm.isRunning - Expected bool return type."); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } /** diff --git a/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp b/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp index 17530ed6d4faaea35ec4c662df9767326c1c3da1..ff167998560b484231b7f011b71c3de7bf5fb9fd 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp @@ -186,6 +186,10 @@ const std::string PropertyWithValueFactory::isArray(PyObject *const object) { PyObject *item = PySequence_Fast_GET_ITEM(object, 0); // Boolean can be cast to int, so check first. +#if __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wparentheses-equality" +#endif if (PyBool_Check(item)) { throw std::runtime_error( "Unable to support extracting arrays of booleans."); @@ -193,6 +197,10 @@ const std::string PropertyWithValueFactory::isArray(PyObject *const object) { if (PyLong_Check(item)) { return std::string("LongIntArray"); } +#if __clang__ +#pragma clang diagnostic pop +#endif + #if PY_MAJOR_VERSION < 3 // In python 2 ints & longs are separate if (PyInt_Check(item)) { diff --git a/MantidPlot/src/PythonScript.cpp b/MantidPlot/src/PythonScript.cpp index 09d6074ccf515e7207a95dd5ae487552d921ea54..30bd97b20e00fb39c2b577ced3915c4968ba2ace 100644 --- a/MantidPlot/src/PythonScript.cpp +++ b/MantidPlot/src/PythonScript.cpp @@ -539,7 +539,14 @@ QVariant PythonScript::evaluateImpl() { } } /* bool */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wparentheses-equality" +#endif else if (PyBool_Check(pyret)) { +#ifdef __clang__ +#pragma clang diagnostic pop +#endif qret = QVariant(pyret == Py_True); } // could handle advanced types (such as PyList->QValueList) here if needed