[PATCH STABLE] parsers: raise an unambiguous type during index lookup (issue4451)

Augie Fackler raf at durin42.com
Wed Jun 10 12:29:27 CDT 2015


On Wed, Jun 10, 2015 at 09:50:31AM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1433955009 25200
> #      Wed Jun 10 09:50:09 2015 -0700
> # Branch stable
> # Node ID 1b4b923551c0a37c129b1d1c530448685e5ca2a2
> # Parent  7298da81f5a9f64ebbdef2b2195585a65da0f99e
> parsers: raise an unambiguous type during index lookup (issue4451)

The patch as stated looks fine, however, I do have one proposal below
that might be of interest.

[snip]

>
> diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -1482,45 +1482,8 @@ static int index_find_node(indexObject *
>               return rev;
>       return -2;
>  }
>
> -static PyObject *raise_revlog_error(void)
> -{
> -	static PyObject *errclass;

We could just dispense with static and load the error every time. This
doesn't look like a path we should hit super-frequently in normal
operations.

> -	PyObject *mod = NULL, *errobj;
> -
> -	if (errclass == NULL) {

[snip]


More information about the Mercurial-devel mailing list