Mercurial > public > mercurial-scm > hg
comparison mercurial/pure/osutil.py @ 29698:f15f31505f12
py3: use unicode literals in pure/osutil.py
The first element of _fields_ tuples must be a str in Python 3.
Also fix some function calls that were also expecting str.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 04 Aug 2016 00:32:19 +0530 |
parents | 7a157639b8f2 |
children | 8656dcac4ce9 |
comparison
equal
deleted
inserted
replaced
29697:00269c6e4f6e | 29698:f15f31505f12 |
---|---|
171 _msg_controllen_t = _socklen_t | 171 _msg_controllen_t = _socklen_t |
172 _msg_iovlen_t = ctypes.c_int | 172 _msg_iovlen_t = ctypes.c_int |
173 | 173 |
174 class _iovec(ctypes.Structure): | 174 class _iovec(ctypes.Structure): |
175 _fields_ = [ | 175 _fields_ = [ |
176 ('iov_base', ctypes.c_void_p), | 176 (u'iov_base', ctypes.c_void_p), |
177 ('iov_len', ctypes.c_size_t), | 177 (u'iov_len', ctypes.c_size_t), |
178 ] | 178 ] |
179 | 179 |
180 class _msghdr(ctypes.Structure): | 180 class _msghdr(ctypes.Structure): |
181 _fields_ = [ | 181 _fields_ = [ |
182 ('msg_name', ctypes.c_void_p), | 182 (u'msg_name', ctypes.c_void_p), |
183 ('msg_namelen', _socklen_t), | 183 (u'msg_namelen', _socklen_t), |
184 ('msg_iov', ctypes.POINTER(_iovec)), | 184 (u'msg_iov', ctypes.POINTER(_iovec)), |
185 ('msg_iovlen', _msg_iovlen_t), | 185 (u'msg_iovlen', _msg_iovlen_t), |
186 ('msg_control', ctypes.c_void_p), | 186 (u'msg_control', ctypes.c_void_p), |
187 ('msg_controllen', _msg_controllen_t), | 187 (u'msg_controllen', _msg_controllen_t), |
188 ('msg_flags', ctypes.c_int), | 188 (u'msg_flags', ctypes.c_int), |
189 ] | 189 ] |
190 | 190 |
191 class _cmsghdr(ctypes.Structure): | 191 class _cmsghdr(ctypes.Structure): |
192 _fields_ = [ | 192 _fields_ = [ |
193 ('cmsg_len', _cmsg_len_t), | 193 (u'cmsg_len', _cmsg_len_t), |
194 ('cmsg_level', ctypes.c_int), | 194 (u'cmsg_level', ctypes.c_int), |
195 ('cmsg_type', ctypes.c_int), | 195 (u'cmsg_type', ctypes.c_int), |
196 ('cmsg_data', ctypes.c_ubyte * 0), | 196 (u'cmsg_data', ctypes.c_ubyte * 0), |
197 ] | 197 ] |
198 | 198 |
199 _libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True) | 199 _libc = ctypes.CDLL(ctypes.util.find_library(u'c'), use_errno=True) |
200 _recvmsg = getattr(_libc, 'recvmsg', None) | 200 _recvmsg = getattr(_libc, 'recvmsg', None) |
201 if _recvmsg: | 201 if _recvmsg: |
202 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long) | 202 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long) |
203 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), | 203 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), |
204 ctypes.c_int) | 204 ctypes.c_int) |