Check if the return value is -1.  If so, goto fail, which will invoke PyErr_Ocurred().

https://docs.python.org/2/c-api/int.html
https://docs.python.org/2/c-api/float.html

Somehow runnning PyErr_Ocurred() when no exception has been generated triggers an unknown thread state and
seg faults.