Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: py3.5
Changeset: r92475:826d99189c3b
Date: 2017-09-27 14:27 +0200
http://bitbucket.org/pypy/pypy/changeset/826d99189c3b/

Log:    Try to fix translation on Windows: skip socket.sendmsg and
        associated macros.

diff --git a/pypy/module/_socket/__init__.py b/pypy/module/_socket/__init__.py
--- a/pypy/module/_socket/__init__.py
+++ b/pypy/module/_socket/__init__.py
@@ -37,7 +37,8 @@
             CMSG_SPACE CMSG_LEN
             """.split():
 
-            if (name in ('inet_pton', 'inet_ntop', 'socketpair') and
+            if (name in ('inet_pton', 'inet_ntop', 'socketpair',
+                         'CMSG_SPACE', 'CMSG_LEN') and
                 not hasattr(rsocket, name)):
                 continue
 
diff --git a/pypy/module/_socket/interp_socket.py 
b/pypy/module/_socket/interp_socket.py
--- a/pypy/module/_socket/interp_socket.py
+++ b/pypy/module/_socket/interp_socket.py
@@ -879,11 +879,14 @@
 socketmethodnames = """
 _accept bind close connect connect_ex fileno detach
 getpeername getsockname getsockopt gettimeout listen
-recv recvfrom recvmsg send sendall sendto sendmsg setblocking
+recv recvfrom send sendall sendto setblocking
 setsockopt settimeout shutdown _reuse _drop recv_into recvfrom_into
 """.split()
 if hasattr(rsocket._c, 'WSAIoctl'):
     socketmethodnames.append('ioctl')
+if rsocket._c.HAVE_SENDMSG:
+    socketmethodnames.append('sendmsg')
+    socketmethodnames.append('recvmsg')
 
 socketmethods = {}
 for methodname in socketmethodnames:
diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -348,7 +348,8 @@
                                  ('ifr_name', rffi.CFixedArray(rffi.CHAR, 8))])
 
 # insert handler for sendmsg / recvmsg here
-if _POSIX:
+HAVE_SENDMSG = bool(_POSIX)
+if HAVE_SENDMSG:
     includes = ['stddef.h',
                 'sys/socket.h',
                 'unistd.h',
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -1393,7 +1393,7 @@
         return (make_socket(fd0, family, type, proto, SocketClass),
                 make_socket(fd1, family, type, proto, SocketClass))
 
-if _c._POSIX:
+if _c.HAVE_SENDMSG:
     def CMSG_LEN( demanded_len):
         """
         Socket method to determine the optimal byte size of the ancillary.
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to