[PATCH 06 of 11] py3: do not pass a float to dict_new_presized()

Yuya Nishihara yuya at tcha.org
Sat Mar 3 08:27:39 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1520077487 18000
#      Sat Mar 03 06:44:47 2018 -0500
# Node ID 87b0df6c39fff3ac758a52a9b0b95bca1f61187c
# Parent  a04953df1a93b64c199ce7be8f2237c225b49de3
py3: do not pass a float to dict_new_presized()

I really don't like the division operator of Python 3 since I'm not doing
a math.

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1431,7 +1431,7 @@ class dirstatemap(object):
             # This heuristic is imperfect in many ways, so in a future dirstate
             # format update it makes sense to just record the number of entries
             # on write.
-            self._map = parsers.dict_new_presized(len(st) / 71)
+            self._map = parsers.dict_new_presized(len(st) // 71)
 
         # Python's garbage collector triggers a GC each time a certain number
         # of container objects (the number being defined by


More information about the Mercurial-devel mailing list