Patchwork py3: leverage pycompat.long

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 27, 2019, 4:15 a.m.
Message ID <77e348a48bac41c28887.1572149711@mimosa>
Download mbox | patch
Permalink /patch/42598/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 27, 2019, 4:15 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1572148313 -32400
#      Sun Oct 27 12:51:53 2019 +0900
# Node ID 77e348a48bac41c28887c2b10afac4a2f6b4bc69
# Parent  fb5c72501de2451a9c785da2912267565ad53cc6
py3: leverage pycompat.long
Pierre-Yves David - Oct. 28, 2019, 11:02 a.m.
This patch looks goods

On 10/27/19 5:15 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1572148313 -32400
> #      Sun Oct 27 12:51:53 2019 +0900
> # Node ID 77e348a48bac41c28887c2b10afac4a2f6b4bc69
> # Parent  fb5c72501de2451a9c785da2912267565ad53cc6
> py3: leverage pycompat.long
> 
> diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
> --- a/mercurial/templatefilters.py
> +++ b/mercurial/templatefilters.py
> @@ -31,9 +31,6 @@ from .utils import (
>   urlerr = util.urlerr
>   urlreq = util.urlreq
>   
> -if pycompat.ispy3:
> -    long = int
> -
>   # filters are callables like:
>   #   fn(obj)
>   # with:
> @@ -329,7 +326,7 @@ def json(obj, paranoid=True):
>           return b'false'
>       elif obj is True:
>           return b'true'
> -    elif isinstance(obj, (int, long, float)):
> +    elif isinstance(obj, (int, pycompat.long, float)):
>           return pycompat.bytestr(obj)
>       elif isinstance(obj, bytes):
>           return b'"%s"' % encoding.jsonescape(obj, paranoid=paranoid)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Augie Fackler - Oct. 28, 2019, 7:17 p.m.
On Sun, Oct 27, 2019 at 01:15:11PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1572148313 -32400
> #      Sun Oct 27 12:51:53 2019 +0900
> # Node ID 77e348a48bac41c28887c2b10afac4a2f6b4bc69
> # Parent  fb5c72501de2451a9c785da2912267565ad53cc6
> py3: leverage pycompat.long

queued, thanks

Patch

diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -31,9 +31,6 @@  from .utils import (
 urlerr = util.urlerr
 urlreq = util.urlreq
 
-if pycompat.ispy3:
-    long = int
-
 # filters are callables like:
 #   fn(obj)
 # with:
@@ -329,7 +326,7 @@  def json(obj, paranoid=True):
         return b'false'
     elif obj is True:
         return b'true'
-    elif isinstance(obj, (int, long, float)):
+    elif isinstance(obj, (int, pycompat.long, float)):
         return pycompat.bytestr(obj)
     elif isinstance(obj, bytes):
         return b'"%s"' % encoding.jsonescape(obj, paranoid=paranoid)