config: fix return conversion in Config_foreach_callback_wrapper()
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>
This commit is contained in:
@@ -235,7 +235,7 @@ Config_foreach_callback_wrapper(const git_config_entry *entry, void *c_payload)
|
||||
if (!(py_result = PyObject_CallObject(py_callback,args)))
|
||||
return -1;
|
||||
|
||||
if (!(c_result = PyLong_AsLong(py_result)))
|
||||
if (c_result = PyLong_AsLong(py_result) == -1)
|
||||
return -1;
|
||||
|
||||
return c_result;
|
||||
|
Reference in New Issue
Block a user