[PATCH] py3: leverage pycompat.long

Yuya Nishihara yuya at tcha.org
Sun Oct 27 00:15:11 EDT 2019


# HG changeset patch
# User Yuya Nishihara <yuya at 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)


More information about the Mercurial-devel mailing list