[Python-checkins] r60367 - python/trunk/Lib/test/test_xmlrpc.py

neal.norwitz python-checkins at python.org
Sun Jan 27 19:19:04 CET 2008


Author: neal.norwitz
Date: Sun Jan 27 19:19:04 2008
New Revision: 60367

Modified:
   python/trunk/Lib/test/test_xmlrpc.py
Log:
Try to handle socket.errors properly in is_unavailable

Modified: python/trunk/Lib/test/test_xmlrpc.py
==============================================================================
--- python/trunk/Lib/test/test_xmlrpc.py	(original)
+++ python/trunk/Lib/test/test_xmlrpc.py	Sun Jan 27 19:19:04 2008
@@ -348,10 +348,14 @@
        given by operations on non-blocking sockets.'''
 
     # sometimes we get a -1 error code and/or empty headers
-    if e.errcode == -1 or e.headers is None:
-        return True
+    try:
+        if e.errcode == -1 or e.headers is None:
+            return True
+        exc_mess = e.headers.get('X-exception')
+    except AttributeError:
+        # Ignore socket.errors here.
+        exc_mess = str(e)
 
-    exc_mess = e.headers.get('X-exception')
     if exc_mess and 'temporarily unavailable' in exc_mess.lower():
         return True
 


More information about the Python-checkins mailing list