]> granicus.if.org Git - python/commitdiff
fix issue 658749: correctly interprets asyncore's windows errors on connect()
authorGiampaolo Rodolà <g.rodola@gmail.com>
Mon, 23 Aug 2010 21:53:41 +0000 (21:53 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Mon, 23 Aug 2010 21:53:41 +0000 (21:53 +0000)
Lib/asyncore.py
Misc/NEWS

index 874f101681aa433e0ea2ca70df5990ca9cbc917c..edb1c7bf5013230dcf43a49f6058ecf98b9af0fa 100644 (file)
@@ -53,7 +53,7 @@ import time
 import warnings
 
 import os
-from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
+from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
      ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, errorcode
 
 try:
@@ -337,8 +337,8 @@ class dispatcher:
     def connect(self, address):
         self.connected = False
         err = self.socket.connect_ex(address)
-        # XXX Should interpret Winsock return values
-        if err in (EINPROGRESS, EALREADY, EWOULDBLOCK):
+        if err in (EINPROGRESS, EALREADY, EWOULDBLOCK) \
+        or err == EINVAL and os.name in ('nt', 'ce'):
             return
         if err in (0, EISCONN):
             self.addr = address
index 75375abe399b151784a99fb22d76e8425f459e3e..dbfdae59180d76c99e50349f2c5be039635202f7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -123,6 +123,9 @@ Extensions
 Library
 -------
 
+- Issue #658749: asyncore's connect() method now correctly interprets winsock
+  errors;
+
 - Issue #9501: Fixed logging regressions in cleanup code.
 
 - Fix functools.total_ordering() to actually work.