Message318001
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] |
|
Date |
User |
Action |
Args |
2018-05-29 09:43:27 | sebastien.bourdeauducq | set | recipients:
+ sebastien.bourdeauducq, asvetlov, yselivanov |
2018-05-29 09:43:27 | sebastien.bourdeauducq | set | messageid: <1527587007.35.0.682650639539.issue33678@psf.upfronthosting.co.za> |
2018-05-29 09:43:27 | sebastien.bourdeauducq | link | issue33678 messages |
2018-05-29 09:43:27 | sebastien.bourdeauducq | create | |
|