osutil: c_ssize_t is only available in Python >= 2.7
authorBryan O'Sullivan <bos@serpentine.com>
Tue, 22 Dec 2015 21:38:06 -0800
changeset 27512 e2aa9c4030c4
parent 27511 44a596a8bed1
child 27514 311eddddca49
osutil: c_ssize_t is only available in Python >= 2.7
mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py	Tue Dec 22 21:38:06 2015 -0800
+++ b/mercurial/pure/osutil.py	Tue Dec 22 21:38:06 2015 -0800
@@ -105,7 +105,7 @@
 
     _libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
     _recvmsg = _libc.recvmsg
-    _recvmsg.restype = ctypes.c_ssize_t
+    _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
     _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), ctypes.c_int)
 
     def _CMSG_FIRSTHDR(msgh):