comparison PyTypeInterface.cpp @ 70:6c755f3e1173

More fixes
author Chris Cannam
date Mon, 17 Nov 2014 14:07:00 +0000
parents 5664fe298af2
children 40a01bb24209
comparison
equal deleted inserted replaced
69:f5b8646494d2 70:6c755f3e1173
180 { 180 {
181 PyErr_Print(); PyErr_Clear(); 181 PyErr_Print(); PyErr_Clear();
182 setValueError("Error while converting integer object.",m_strict); 182 setValueError("Error while converting integer object.",m_strict);
183 return 0; 183 return 0;
184 } 184 }
185 // this test is nonsense -- neither part can occur
186 // owing to range of data types -- size_t is at least
187 // as big as long, and unsigned is always non-negative
188 /*
185 if ((unsigned long)rValue > SIZE_T_MAX || (unsigned long)rValue < 0) 189 if ((unsigned long)rValue > SIZE_T_MAX || (unsigned long)rValue < 0)
186 { 190 {
187 setValueError("Overflow error. Object can not be converted to size_t.",m_strict); 191 setValueError("Overflow error. Object can not be converted to size_t.",m_strict);
188 return 0; 192 return 0;
189 } 193 }
194 */
190 return (size_t) rValue; 195 return (size_t) rValue;
191 } 196 }
192 197
193 // in strict mode we will not try harder and throw an exception 198 // in strict mode we will not try harder and throw an exception
194 // then the caller should decide what to do with it 199 // then the caller should decide what to do with it
715 /// check dimensions 720 /// check dimensions
716 if (PyArray_NDIM(pyArray) != 1) { 721 if (PyArray_NDIM(pyArray) != 1) {
717 std::string msg = "NumPy array must be a one dimensional vector."; 722 std::string msg = "NumPy array must be a one dimensional vector.";
718 setValueError(msg,m_strict); 723 setValueError(msg,m_strict);
719 #ifdef _DEBUG 724 #ifdef _DEBUG
720 cerr << "PyTypeInterface::PyArray_To_FloatVector failed. Error: " << msg << " Dims: " << (int) pyArray->nd << endl; 725 cerr << "PyTypeInterface::PyArray_To_FloatVector failed. Error: " << msg << " Dims: " << (int) PyArray_NDIM(pyArray) << endl;
721 #endif 726 #endif
722 return Output; 727 return Output;
723 } 728 }
724 729
725 #ifdef _DEBUG_VALUES 730 #ifdef _DEBUG_VALUES