Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3.5
Changeset: r92645:ee5f3be5fea2
Date: 2017-10-07 20:27 +0000
http://bitbucket.org/pypy/pypy/changeset/ee5f3be5fea2/

Log:    Merged in Dodan/pypy_sendmsg_patch/py3.5 (pull request #569)

        Fix issues #2648 and #2649

diff --git a/pypy/module/_socket/test/test_sock_app.py 
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -574,6 +574,22 @@
         import _socket
         raises(_socket.error, _socket.dup, 123456)
 
+    def test_recvmsg_issue2649(self):
+        import _socket as socket
+        listener = socket.socket(family=socket.AF_INET6, 
type=socket.SOCK_DGRAM)
+        listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+        listener.bind(('::1', 1234))
+
+        s = socket.socket(family=socket.AF_INET6, type=socket.SOCK_DGRAM)
+        IPV6_RECVERR = 25
+        s.setsockopt(socket.IPPROTO_IPV6, IPV6_RECVERR, 1)
+
+        s.sendto(b'x', ('::1', 1234))
+        try:
+            queue = s.recvmsg(1024, 1024, socket.MSG_ERRQUEUE)
+        except BlockingIOError as e:
+            assert True
+
     def test_buffer(self):
         # Test that send/sendall/sendto accept a buffer as arg
         import _socket, os
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
@@ -162,7 +162,7 @@
 IP_RECVRETOPTS IP_RETOPTS IP_TOS IP_TTL
 
 MSG_BTAG MSG_ETAG MSG_CTRUNC MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_OOB
-MSG_PEEK MSG_TRUNC MSG_WAITALL
+MSG_PEEK MSG_TRUNC MSG_WAITALL MSG_ERRQUEUE
 
 NI_DGRAM NI_MAXHOST NI_MAXSERV NI_NAMEREQD NI_NOFQDN NI_NUMERICHOST
 NI_NUMERICSERV
@@ -535,7 +535,7 @@
             int cmsg_status;
             struct iovec iov;
             struct recvmsg_info* retinfo;
-            int error_flag;   // variable to be set in case of special errors.
+            int error_flag = 0;   // variable to be set in case of special 
errors.
             int cmsgdatalen = 0;
 
             // variables that are set to 1, if the message charp has been 
allocated
@@ -709,6 +709,7 @@
                     free(retinfo);
                 }
             }
+            if (error_flag==0) error_flag = -1;
             return error_flag;
 
         err_closefds:
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -1074,7 +1074,7 @@
 
             if address is not None:
                 address.unlock()
-            if _c.geterrno() == _c.EINTR:
+            if (_c.geterrno() == _c.EINTR) or (_c.geterrno() == 11):
                 raise last_error()
             if (reply == -10000):
                 raise RSocketError("Invalid message size")
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to