##// END OF EJS Templates
py3: work around the lack of sys.maxint in contrib/perf
Matt Harbison -
r39848:c4ab9fa8 default
parent child Browse files
Show More
@@ -69,9 +69,14 b' try:'
69 getargspec = pycompat.getargspec # added to module after 4.5
69 getargspec = pycompat.getargspec # added to module after 4.5
70 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
70 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
71 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
71 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
72 if pycompat.ispy3:
73 _maxint = sys.maxsize # per py3 docs for replacing maxint
74 else:
75 _maxint = sys.maxint
72 except (ImportError, AttributeError):
76 except (ImportError, AttributeError):
73 import inspect
77 import inspect
74 getargspec = inspect.getargspec
78 getargspec = inspect.getargspec
79 _maxint = sys.maxint # no py3 support
75 _sysstr = lambda x: x # no py3 support
80 _sysstr = lambda x: x # no py3 support
76 _xrange = xrange
81 _xrange = xrange
77
82
@@ -1894,7 +1899,7 b' def perflrucache(ui, mincost=0, maxcost='
1894
1899
1895 values = []
1900 values = []
1896 for i in _xrange(size):
1901 for i in _xrange(size):
1897 values.append(random.randint(0, sys.maxint))
1902 values.append(random.randint(0, _maxint))
1898
1903
1899 # Get mode fills the cache and tests raw lookup performance with no
1904 # Get mode fills the cache and tests raw lookup performance with no
1900 # eviction.
1905 # eviction.
@@ -1925,7 +1930,7 b' def perflrucache(ui, mincost=0, maxcost='
1925 setseq = []
1930 setseq = []
1926 costs = []
1931 costs = []
1927 for i in _xrange(sets):
1932 for i in _xrange(sets):
1928 setseq.append(random.randint(0, sys.maxint))
1933 setseq.append(random.randint(0, _maxint))
1929 costs.append(random.choice(costrange))
1934 costs.append(random.choice(costrange))
1930
1935
1931 def doinserts():
1936 def doinserts():
General Comments 0
You need to be logged in to leave comments. Login now