# HG changeset patch # User Rodrigo Damazio Bovendorp # Date 2019-06-26 02:30:24 # Node ID f3fa10a5877dbc67422afe657065dcd030353779 # Parent 49998d5ba66a1848ba8b4df368f78d75ba31c09f py3: use integer division for the value passed to xrange Differential Revision: https://phab.mercurial-scm.org/D6576 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 @@ if not pycompat.iswindows: 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)]