Patchwork D6576: py3: use integer division for the value passed to xrange

login
register
mail settings
Submitter phabricator
Date June 27, 2019, 4:19 p.m.
Message ID <5f7cabe52b2480bc6d479b4dfd970657@localhost.localdomain>
Download mbox | patch
Permalink /patch/40692/
State Not Applicable
Headers show

Comments

phabricator - June 27, 2019, 4:19 p.m.
Closed by commit rHGf3fa10a5877d: py3: use integer division for the value passed to xrange (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6576?vs=15659&id=15676

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6576/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6576

AFFECTED FILES
  mercurial/pure/osutil.py

CHANGE DETAILS




To: rdamazio, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -5,7 +5,7 @@ 
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from __future__ import absolute_import
+from __future__ import absolute_import, division
 
 import ctypes
 import ctypes.util
@@ -149,7 +149,7 @@ 
             cmsg.cmsg_type != _SCM_RIGHTS):
             return []
         rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int))
-        rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) /
+        rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) //
                      ctypes.sizeof(ctypes.c_int))
         return [rfds[i] for i in pycompat.xrange(rfdscount)]