Mercurial > hg > vampy
diff PyPlugin.cpp @ 71:40a01bb24209 vampyhost
Pull apart some type conversion classes for possible use in VamPy Host
author | Chris Cannam |
---|---|
date | Thu, 20 Nov 2014 13:02:50 +0000 |
parents | 146d14ab15e7 |
children | ffaa1fb3d7de |
line wrap: on
line diff
--- a/PyPlugin.cpp Mon Nov 17 14:07:00 2014 +0000 +++ b/PyPlugin.cpp Thu Nov 20 13:02:50 2014 +0000 @@ -87,8 +87,12 @@ if (m_debugFlag && m_quitOnErrorFlag) cerr << "Quit on type error ON for: " << m_class << endl; if (m_debugFlag && st_flag) cerr << "Strict type conversion ON for: " << m_class << endl; + m_ti.setStrictTypingFlag(st_flag); + m_tc.setStrictTypingFlag(st_flag); + m_ti.setNumpyInstalled(m_numpyInstalled); + m_tc.setNumpyInstalled(m_numpyInstalled); } @@ -318,8 +322,8 @@ { if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} } else { - rValue = m_ti.PyValue_To_Bool(pyValue); - if (m_ti.error) { + rValue = m_tc.PyValue_To_Bool(pyValue); + if (m_tc.error) { Py_CLEAR(pyValue); typeErrorHandler(flagName); rValue = defValue; @@ -341,8 +345,8 @@ { if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} } else { - rValue |= (int) m_ti.PyValue_To_Size_t(pyValue); - if (m_ti.error) { + rValue |= (int) m_tc.PyValue_To_Size_t(pyValue); + if (m_tc.error) { Py_CLEAR(pyValue); typeErrorHandler(flagName); rValue = defValue; @@ -430,8 +434,10 @@ PyPlugin::typeErrorHandler(const char *method, bool process) const { bool strict = false; - while (m_ti.error) { - PyTypeInterface::ValueError e = m_ti.getError(); + while (m_tc.error || m_ti.error) { + ValueError e; + if (m_tc.error) e = m_tc.getError(); + else e = m_ti.getError(); #ifdef HAVE_NUMPY // disable the process completely if numpy types are returned // but a compatible version was not loaded.