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

Augie Fackler raf at durin42.com
Wed Jun 10 12:36:47 CDT 2015


On Wed, Jun 10, 2015 at 1:34 PM, Gregory Szorc <gregory.szorc at gmail.com> wrote:
> On Wed, Jun 10, 2015 at 10:29 AM, Augie Fackler <raf at durin42.com> wrote:
>>
>> 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.
>
>
> Perhaps. But as I mentioned in the commit message, the actual type doesn't
> really matter. Raising RevlogError from C feels like extra, unjustified
> complexity to me. But I'll restore it if that's what is wanted.

I don't feel strongly - I'll leave that up to others. My pedantic side
is twitchy about IndexError for this case, but I also know that I'm
probably being too picky. If marmoute doesn't mind the end result of
this patch, I can certainly live with it. :)


More information about the Mercurial-devel mailing list