]> granicus.if.org Git - python/commitdiff
Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.
authorNed Deily <nad@acm.org>
Fri, 14 Feb 2014 06:50:42 +0000 (22:50 -0800)
committerNed Deily <nad@acm.org>
Fri, 14 Feb 2014 06:50:42 +0000 (22:50 -0800)
Lib/test/test_socket.py
Misc/NEWS

index 67ff1beede87e535ab51d69ab3b90128e548f0dc..450aee1d43343f7d56169ed2a0b0b8531f84f2e9 100644 (file)
@@ -1164,9 +1164,15 @@ class GeneralModuleTests(unittest.TestCase):
         # Issue #6697.
         self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800')
 
-        # Issue 17269
+        # Issue 17269: test workaround for OS X platform bug segfault
         if hasattr(socket, 'AI_NUMERICSERV'):
-            socket.getaddrinfo("localhost", None, 0, 0, 0, socket.AI_NUMERICSERV)
+            try:
+                # The arguments here are undefined and the call may succeed
+                # or fail.  All we care here is that it doesn't segfault.
+                socket.getaddrinfo("localhost", None, 0, 0, 0,
+                                   socket.AI_NUMERICSERV)
+            except socket.gaierror:
+                pass
 
     def test_getnameinfo(self):
         # only IP addresses are allowed
index e5157cf2279c76007540486c1233ad48eea9ec85..b2260725099e818a8a07e087e3dde7a086f3d95c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -116,6 +116,8 @@ Tests
 
 - Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+.
 
+- Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.
+
 Documentation
 -------------