[New-bugs-announce] [issue15982] asyncore.dispatcher does not handle windows socket error code correctly (namely WSAEWOULDBLOCK 10035)
Nicolai Ehemann
report at bugs.python.org
Thu Sep 20 13:12:50 CEST 2012
New submission from Nicolai Ehemann:
There are some differences between win32 and other os socket implementations. One specific I found is that in windows, non-blocking socket apis will return WSAEWOULDBLOCK or 10035 instead of EWOULDBLOCK.
This causes recv() in asyncore.dispatcher to raise an unhandled exception instead of continuing gracefully.
The fix could maybe be as simple as replacing line 384 in asyncore.py:
data = self.socket.recv(buffer_size)
with
try:
data = self.socket.recv(buffer_size)
except socket.error as e:
if 10035 == e.errno:
pass
else:
raise e
The differences between windows and unix non-blocking sockets are summarized quite nice here: http://itamarst.org/writings/win32sockets.html
The original documentation from microsoft can be found here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx
----------
components: Library (Lib)
messages: 170799
nosy: McNetic
priority: normal
severity: normal
status: open
title: asyncore.dispatcher does not handle windows socket error code correctly (namely WSAEWOULDBLOCK 10035)
type: behavior
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15982>
_______________________________________
More information about the New-bugs-announce
mailing list