[PATCH 1 of 6 lazymanifest-errors] lazymanifest: check another error return in getitem

Yuya Nishihara yuya at tcha.org
Fri Jan 1 09:45:15 UTC 2016


On Thu, 31 Dec 2015 14:05:45 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf at durin42.com>
> # Date 1451586967 18000
> #      Thu Dec 31 13:36:07 2015 -0500
> # Node ID 0d56affe821052f6763f1796341d892c68339fa9
> # Parent  7683ed1377dad6ece4dbe2276a8a166c77599a8d
> lazymanifest: check another error return in getitem
> 
> diff --git a/mercurial/manifest.c b/mercurial/manifest.c
> --- a/mercurial/manifest.c
> +++ b/mercurial/manifest.c
> @@ -394,6 +394,9 @@ static PyObject *lazymanifest_getitem(la
>  		return NULL;
>  	}
>  	needle.start = PyString_AsString(key);
> +	if (!needle.start) {
> +		return NULL;
> +	}

It won't need error return because we do PyString_Check(key) before.

Perhaps we can use PyString_AS_STRING() and PyTuple_GET_ITEM() to clarify
that error handling is omitted explicitly.

I've pushed 4 and 6.


More information about the Mercurial-devel mailing list