config: return -1 on error in Config_foreach_callback_wrapper().
Config_foreach_callback_wrapper is supposed to return 0 on success. From the docstring: As soon as one of the callbacks returns an integer other than 0, this function returns that value. If we've already had an exception, we want to bail immediately and raise the exception. Signed-off-by: W. Trevor King <wking@tremily.us>
This commit is contained in:
@@ -223,20 +223,20 @@ Config_foreach_callback_wrapper(const git_config_entry *entry, void *c_payload)
|
|||||||
int c_result;
|
int c_result;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|O", &py_callback, &py_payload))
|
if (!PyArg_ParseTuple(args, "O|O", &py_callback, &py_payload))
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
if (py_payload)
|
if (py_payload)
|
||||||
args = Py_BuildValue("ssO", entry->name, entry->value, py_payload);
|
args = Py_BuildValue("ssO", entry->name, entry->value, py_payload);
|
||||||
else
|
else
|
||||||
args = Py_BuildValue("ss", entry->name, entry->value);
|
args = Py_BuildValue("ss", entry->name, entry->value);
|
||||||
if (!args)
|
if (!args)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
if (!(py_result = PyObject_CallObject(py_callback,args)))
|
if (!(py_result = PyObject_CallObject(py_callback,args)))
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
if (!(c_result = PyLong_AsLong(py_result)))
|
if (!(c_result = PyLong_AsLong(py_result)))
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
return c_result;
|
return c_result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user