Check return value of PyLong_AsDouble(), it can return an error.
Attach a file by drag & drop or click to upload