Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pure/osutil.py @ 42531:f3fa10a5877d
py3: use integer division for the value passed to xrange
Differential Revision: https://phab.mercurial-scm.org/D6576
author | Rodrigo Damazio Bovendorp <rdamazio@google.com> |
---|---|
date | Tue, 25 Jun 2019 19:30:24 -0700 |
parents | 120ecb17242b |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
42530:49998d5ba66a | 42531:f3fa10a5877d |
---|---|
3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others | 3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others |
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import, division |
9 | 9 |
10 import ctypes | 10 import ctypes |
11 import ctypes.util | 11 import ctypes.util |
12 import os | 12 import os |
13 import socket | 13 import socket |
147 return [] | 147 return [] |
148 if (cmsg.cmsg_level != socket.SOL_SOCKET or | 148 if (cmsg.cmsg_level != socket.SOL_SOCKET or |
149 cmsg.cmsg_type != _SCM_RIGHTS): | 149 cmsg.cmsg_type != _SCM_RIGHTS): |
150 return [] | 150 return [] |
151 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int)) | 151 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int)) |
152 rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) / | 152 rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) // |
153 ctypes.sizeof(ctypes.c_int)) | 153 ctypes.sizeof(ctypes.c_int)) |
154 return [rfds[i] for i in pycompat.xrange(rfdscount)] | 154 return [rfds[i] for i in pycompat.xrange(rfdscount)] |
155 | 155 |
156 else: | 156 else: |
157 import msvcrt | 157 import msvcrt |