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

login
register
mail settings
Submitter phabricator
Date June 26, 2019, 2:38 a.m.
Message ID <differential-rev-PHID-DREV-wybbjtdwfv4xaoe67mwf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40675/
State Superseded
Headers show

Comments

phabricator - June 26, 2019, 2:38 a.m.
rdamazio created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/pure/osutil.py

CHANGE DETAILS




To: rdamazio, #hg-reviewers
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)]