This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sebastien.bourdeauducq
Recipients asvetlov, sebastien.bourdeauducq, yselivanov
Date 2018-05-29.09:43:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527587007.35.0.682650639539.issue33678@psf.upfronthosting.co.za>
In-reply-to
Content
The current behavior causes an exception to be raised when trying to create a datagram socket and _ipaddr_info returns None (since asyncio then calls loop.getaddrinfo with SOCK_STREAM and IPPROTO_UDP).

Preserving socket type is made difficult by https://bugs.python.org/issue21327; the proposed patch includes a dirty workaround. I do not know yet if it works on Windows.

--- selector_events.py  2018-05-11 10:01:42.011164837 +0800
+++ selector_events.py.new      2018-05-29 17:41:03.103155480 +0800
@@ -439,8 +439,9 @@
             raise ValueError("the socket must be non-blocking")
 
         if not hasattr(socket, 'AF_UNIX') or sock.family != socket.AF_UNIX:
+            socktype = sock.type & 0xf  # WA https://bugs.python.org/issue21327
             resolved = base_events._ensure_resolved(
-                address, family=sock.family, proto=sock.proto, loop=self)
+                address, family=sock.family, type=socktype, proto=sock.proto, loop=self)
             if not resolved.done():
                 yield from resolved
             _, _, _, _, address = resolved.result()[0]
History
Date User Action Args
2018-05-29 09:43:27sebastien.bourdeauducqsetrecipients: + sebastien.bourdeauducq, asvetlov, yselivanov
2018-05-29 09:43:27sebastien.bourdeauducqsetmessageid: <1527587007.35.0.682650639539.issue33678@psf.upfronthosting.co.za>
2018-05-29 09:43:27sebastien.bourdeauducqlinkissue33678 messages
2018-05-29 09:43:27sebastien.bourdeauducqcreate