[PATCH 3 of 3 STABLE] rust: propagate Python exception raised from index_get_parents_checked()

Yuya Nishihara yuya at tcha.org
Mon Oct 29 09:03:04 EDT 2018


On Sun, 28 Oct 2018 22:11:03 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1540730473 -32400
> #      Sun Oct 28 21:41:13 2018 +0900
> # Branch stable
> # Node ID c40ceec4d993927b6788ad430dc6b4f3087d9aeb
> # Parent  28a5ec244ba88ce4a46a26a32c24fa36f7597245
> rust: propagate Python exception raised from index_get_parents_checked()

>  static int rustla_contains(rustlazyancestorsObject *self, PyObject *rev) {
> +	int res;
>  	if (!(PyInt_Check(rev))) {
>  		return 0;
>  	}
> -	return rustlazyancestors_contains(self->iter, PyInt_AS_LONG(rev));
> +	res = rustlazyancestors_contains(self->iter, PyInt_AS_LONG(rev));
> +	if (PyErr_Occurred())
> +		return -1;
> +	return res;

Not that a proper fix is to make AncestorsIterator functions return
Result<_, GraphError>. I can send the patch for stable if it's preferred.


More information about the Mercurial-devel mailing list