[PATCH 1 of 7] formatter: support json formatting of long type

Gregory Szorc gregory.szorc at gmail.com
Tue Mar 14 12:00:09 EDT 2017


On Tue, Mar 14, 2017 at 1:19 AM, Yuya Nishihara <yuya at tcha.org> wrote:

> On Mon, 13 Mar 2017 22:15:43 -0700, Gregory Szorc wrote:
> > # HG changeset patch
> > # User Gregory Szorc <gregory.szorc at gmail.com>
> > # Date 1489455089 25200
> > #      Mon Mar 13 18:31:29 2017 -0700
> > # Node ID f6f1f5efe05f4e3737dc198284f548e31a616f4b
> > # Parent  1c48a8278b2f015fca607dfc652823560a5ac580
> > formatter: support json formatting of long type
> >
> > By luck, we appear to not pass any long instances into
> > the JSON formatter. I suspect this will change with all the
> > Python 3 porting work. Plus I have another series that will
> > convert some ints to longs that triggers this.
> >
> > diff --git a/mercurial/formatter.py b/mercurial/formatter.py
> > --- a/mercurial/formatter.py
> > +++ b/mercurial/formatter.py
> > @@ -295,7 +295,7 @@ def _jsonifyobj(v):
> >          return 'true'
> >      elif v is False:
> >          return 'false'
> > -    elif isinstance(v, (int, float)):
> > +    elif isinstance(v, (int, long, float)):
> >          return str(v)
>
> Looks okay, but we'll need to export long on Python 3, by pycompat or code
> transformer.
>

I see you queued this. I also see it doesn't break the py3 tests with
3.5.0. Furthermore, there are a handful of "long" usages throughout the
repo. So I guess I left a landmine for whoever hits this with Python 3
porting :/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170314/5f968cc5/attachment.html>


More information about the Mercurial-devel mailing list