]> granicus.if.org Git - python/commitdiff
At the C level, tuple arguments are passed in directly to the exception
authorBrett Cannon <bcannon@gmail.com>
Wed, 21 Jun 2006 16:57:57 +0000 (16:57 +0000)
committerBrett Cannon <bcannon@gmail.com>
Wed, 21 Jun 2006 16:57:57 +0000 (16:57 +0000)
constructor, meaning it is treated as *args, not as a single argument.  This
means using the 'message' attribute won't work (until Py3K comes around),
and so one must grab from 'arg' to get the error number.

Lib/test/test_socket_ssl.py

index fc9d09fe4b9d410c5e40902b909918da6796bd5f..41eab69d8f594c5379a3028cd8b025d8e8c13b2c 100644 (file)
@@ -56,11 +56,11 @@ def test_timeout():
     use a more reliable address.""" % (ADDR,)
         return
     except socket.error, exc:  # In case connection is refused.
-        if (isinstance(exc.message, tuple) and
-            exc.message[0] == errno.ECONNREFUSED):
-            raise test_support.TestSkipped("test socket connection refused")
+        if exc.args[0] == errno.ECONNREFUSED:
+            print "Connection refused when connecting to", ADDR
+            return
         else:
-            raise exc
+            raise
 
     ss = socket.ssl(s)
     # Read part of return welcome banner twice.