Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76fc8c7

Browse files
committed
fix issue 658749: correctly interprets asyncore's windows errors on connect()
1 parent 0538064 commit 76fc8c7

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/asyncore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import warnings
5454

5555
import os
56-
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
56+
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
5757
ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, errorcode
5858

5959
try:
@@ -337,8 +337,8 @@ def bind(self, addr):
337337
def connect(self, address):
338338
self.connected = False
339339
err = self.socket.connect_ex(address)
340-
# XXX Should interpret Winsock return values
341-
if err in (EINPROGRESS, EALREADY, EWOULDBLOCK):
340+
if err in (EINPROGRESS, EALREADY, EWOULDBLOCK) \
341+
or err == EINVAL and os.name in ('nt', 'ce'):
342342
return
343343
if err in (0, EISCONN):
344344
self.addr = address

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ Extensions
123123
Library
124124
-------
125125

126+
- Issue #658749: asyncore's connect() method now correctly interprets winsock
127+
errors;
128+
126129
- Issue #9501: Fixed logging regressions in cleanup code.
127130

128131
- Fix functools.total_ordering() to actually work.

0 commit comments

Comments
 (0)