PyLong_AsLong() returns -1 on error. The previous implementation returned -1 when py_result was 0, which killed every .foreach() iteration after the first callback. We could skip the if clause and just return the result of PyLong_AsLong(), but keeping the if clause makes it more obvious that we *did* think about handling errors from PyLong_AsLong(). Signed-off-by: W. Trevor King <wking@tremily.us>