Rev 4811: On Windows socket.select() raises WSAENOTSOCK not EBADF. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-test-kipple

John Arbash Meinel john at arbash-meinel.com
Wed Nov 18 17:36:43 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-test-kipple

------------------------------------------------------------
revno: 4811
revision-id: john at arbash-meinel.com-20091118173636-25khv5gnut0r5wcd
parent: john at arbash-meinel.com-20091118172218-8af5g41v0kr54mq1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-test-kipple
timestamp: Wed 2009-11-18 11:36:36 -0600
message:
  On Windows socket.select() raises WSAENOTSOCK not EBADF.
-------------- next part --------------
=== modified file 'bzrlib/tests/http_server.py'
--- a/bzrlib/tests/http_server.py	2009-11-11 07:23:59 +0000
+++ b/bzrlib/tests/http_server.py	2009-11-18 17:36:36 +0000
@@ -494,13 +494,16 @@
             except socket.timeout:
                 pass
             except (socket.error, select.error), e:
-               if e[0] == errno.EBADF:
-                   # Starting with python-2.6, handle_request may raise socket
-                   # or select exceptions when the server is shut down (as we
-                   # do).
-                   pass
-               else:
-                   raise
+                if (e[0] == errno.EBADF
+                    or (sys.platform == 'win32' and e[0] == 10038)):
+                    # Starting with python-2.6, handle_request may raise socket
+                    # or select exceptions when the server is shut down (as we
+                    # do).
+                    # 10038 = WSAENOTSOCK
+                    # http://msdn.microsoft.com/en-us/library/ms740668%28VS.85%29.aspx
+                    pass
+                else:
+                    raise
 
     def _get_remote_url(self, path):
         path_parts = path.split(os.path.sep)



More information about the bazaar-commits mailing list