Patchwork [04,of,10,py3] revlog: use int instead of long

login
register
mail settings
Submitter Augie Fackler
Date March 19, 2017, 6:26 p.m.
Message ID <b9ee2497bba6e49fb08e.1489947977@imladris.local>
Download mbox | patch
Permalink /patch/19453/
State Accepted
Headers show

Comments

Augie Fackler - March 19, 2017, 6:26 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489899928 14400
#      Sun Mar 19 01:05:28 2017 -0400
# Node ID b9ee2497bba6e49fb08e0119cef0f27baccb61f8
# Parent  9c25b4e6ab7bf364a101d8a0bc7c8a196131add8
revlog: use int instead of long

By my reading of PEP 237[0], this is completely safe and has been
since Python 2.2.

0: https://www.python.org/dev/peps/pep-0237/

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -117,7 +117,7 @@  def gettype(q):
 def offset_type(offset, type):
     if (type & ~REVIDX_KNOWN_FLAGS) != 0:
         raise ValueError('unknown revlog index flags')
-    return long(long(offset) << 16 | type)
+    return int(int(offset) << 16 | type)
 
 _nullhash = hashlib.sha1(nullid)