Fix a few exception returns.
Change-Id: Ibb36fd6c14450dfb436ee545b1a91e44b8b2f8cb
This commit is contained in:
12
pygit2.c
12
pygit2.c
@@ -195,7 +195,7 @@ static Object *wrap_object(git_object *obj, Repository *repo) {
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
if (!py_obj)
|
if (!py_obj)
|
||||||
return NULL;
|
return (Object*)PyErr_NoMemory();
|
||||||
|
|
||||||
py_obj->obj = obj;
|
py_obj->obj = obj;
|
||||||
py_obj->repo = repo;
|
py_obj->repo = repo;
|
||||||
@@ -219,11 +219,11 @@ Repository_getitem(Repository *self, PyObject *value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
obj = git_repository_lookup(self->repo, &oid, GIT_OBJ_ANY);
|
obj = git_repository_lookup(self->repo, &oid, GIT_OBJ_ANY);
|
||||||
if (!obj) {
|
/* Grr, libgit2 currently doesn't give us any info on this error, so we
|
||||||
PyErr_Format(PyExc_RuntimeError, "Failed to look up hex SHA \"%s\"",
|
* can't even tell the difference between a missing object and, say, an I/O
|
||||||
hex);
|
* error. */
|
||||||
return NULL;
|
if (!obj)
|
||||||
}
|
return Error_set_py_str(GIT_ENOTFOUND, value);
|
||||||
|
|
||||||
py_obj = wrap_object(obj, self);
|
py_obj = wrap_object(obj, self);
|
||||||
if (!py_obj)
|
if (!py_obj)
|
||||||
|
Reference in New Issue
Block a user