# HG changeset patch # User Matt Harbison <matt_harbi...@yahoo.com> # Date 1537575373 14400 # Fri Sep 21 20:16:13 2018 -0400 # Node ID 3709e38b0d5b812e2f11f27f493e6f0e30def497 # Parent 2f15c0bb3936f8f929e6af509778e3a6ef8ed704 py3: work around the lack of sys.maxint in contrib/perf
diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -69,9 +69,14 @@ try: getargspec = pycompat.getargspec # added to module after 4.5 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede) _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b) + if pycompat.ispy3: + _maxint = sys.maxsize # per py3 docs for replacing maxint + else: + _maxint = sys.maxint except (ImportError, AttributeError): import inspect getargspec = inspect.getargspec + _maxint = sys.maxint # no py3 support _sysstr = lambda x: x # no py3 support _xrange = xrange @@ -1894,7 +1899,7 @@ def perflrucache(ui, mincost=0, maxcost= values = [] for i in _xrange(size): - values.append(random.randint(0, sys.maxint)) + values.append(random.randint(0, _maxint)) # Get mode fills the cache and tests raw lookup performance with no # eviction. @@ -1925,7 +1930,7 @@ def perflrucache(ui, mincost=0, maxcost= setseq = [] costs = [] for i in _xrange(sets): - setseq.append(random.randint(0, sys.maxint)) + setseq.append(random.randint(0, _maxint)) costs.append(random.choice(costrange)) def doinserts(): _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel