Clear error status after calling PyObject_Generic?etAttr methods.

This commit is contained in:
Alistair Riddoch 2009-07-02 01:51:08 +01:00
parent 9f0eca45b0
commit 2d3bb5b30e
3 changed files with 8 additions and 1 deletions

View file

@ -69,7 +69,10 @@ void PythonArithmeticScript::set(const std::string & name, const float & val)
{
PyObject * pn = PyString_FromString(name.c_str());
PyObject * py_val = PyFloat_FromDouble(val);
PyObject_GenericSetAttr(m_script, pn, py_val);
if (PyObject_GenericSetAttr(m_script, pn, py_val) == 0) {
// PyObject_GenericSetAttr sets and error if nothing was found
PyErr_Clear();
}
Py_DECREF(pn);
Py_DECREF(py_val);
}