| 14 | { |
| 15 | |
| 16 | bool ToFloatTuple( PyObject* value, ssize_t length, float* destination ) |
| 17 | { |
| 18 | if( PyTuple_Check( value ) && PyTuple_GET_SIZE( value ) == length ) |
| 19 | { |
| 20 | for( ssize_t i = 0; i < length; ++i ) |
| 21 | { |
| 22 | auto item = PyTuple_GET_ITEM( value, i ); |
| 23 | if( PyFloat_Check( item ) ) |
| 24 | { |
| 25 | destination[i] = float( PyFloat_AsDouble( item ) ); |
| 26 | } |
| 27 | else if( PyLong_Check( item ) ) |
| 28 | { |
| 29 | destination[i] = float( PyLong_AsDouble( item ) ); |
| 30 | } |
| 31 | #if PY_MAJOR_VERSION == 2 |
| 32 | else if( PyInt_Check( item ) ) |
| 33 | { |
| 34 | destination[i] = float( PyInt_AsLong( item ) ); |
| 35 | } |
| 36 | #endif |
| 37 | else |
| 38 | { |
| 39 | return false; |
| 40 | } |
| 41 | } |
| 42 | return true; |
| 43 | } |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | } |
| 48 |
no outgoing calls
no test coverage detected