[PATCH 3 of 8] pure/osutil: c_ssize_t is only available in Python >= 2.7

Bryan O'Sullivan bos at serpentine.com
Wed Dec 23 00:24:41 CST 2015


# HG changeset patch
# User Bryan O'Sullivan <bos at serpentine.com>
# Date 1450849086 28800
#      Tue Dec 22 21:38:06 2015 -0800
# Node ID 84a069c3cf4bfcc56cd889a7c03ef974d3913b98
# Parent  a29971f960ad845a4ffac06d7d1b7901d05268f7
pure/osutil: c_ssize_t is only available in Python >= 2.7

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -105,7 +105,7 @@ if os.name != 'nt':
 
     _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):


More information about the Mercurial-devel mailing list