Message357937
> In writing a simple UDP client using asyncio, I tripped over a call to getsockname() in the _SelectorTransport class in asyncio/selector_events.py. (...)
This bug has been fixed recently by:
commit 63deaa5b70108ef441c57728322da6b4321db4fc
Author: Vincent Michel <vxgmichel@gmail.com>
Date: Tue May 7 19:18:49 2019 +0200
bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423)
Extract of the change:
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 93b6889509..29968214f8 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -587,7 +587,10 @@ class _SelectorTransport(transports._FlowControlMixin,
def __init__(self, loop, sock, protocol, extra=None, server=None):
super().__init__(extra, loop)
self._extra['socket'] = sock
- self._extra['sockname'] = sock.getsockname()
+ try:
+ self._extra['sockname'] = sock.getsockname()
+ except OSError:
+ self._extra['sockname'] = None
if 'peername' not in self._extra:
try:
self._extra['peername'] = sock.getpeername()
Thanks for your contribution and your proposed patch Paul McGuire! Sorry for the late reply. I mark this change as a duplicate of bpo-31922. |
|
Date |
User |
Action |
Args |
2019-12-06 18:57:40 | vstinner | set | recipients:
+ vstinner, gvanrossum, yselivanov, Paul McGuire |
2019-12-06 18:57:39 | vstinner | set | messageid: <1575658659.99.0.711709572598.issue27822@roundup.psfhosted.org> |
2019-12-06 18:57:39 | vstinner | link | issue27822 messages |
2019-12-06 18:57:39 | vstinner | create | |
|