]> 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:49:30 +0000 (22:49 -0800)
committerNed Deily <nad@acm.org>
Fri, 14 Feb 2014 06:49:30 +0000 (22:49 -0800)
Lib/test/test_socket.py
Misc/NEWS

index 5fd96fec64117b4583e214cb17f0b23646f21f73..5d5005bc6cd53657725d1f1dc39b9b68db7b66c3 100644 (file)
@@ -663,9 +663,15 @@ class GeneralModuleTests(unittest.TestCase):
         socket.getaddrinfo(None, 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0,
                            socket.AI_PASSIVE)
 
-        # 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 check_sendall_interrupted(self, with_timeout):
         # socketpair() is not stricly required, but it makes things easier.
index a823fa7692dcaabad2b1d1e94220219f944e5471..178fd5b759e0f38dcc0276d539e2affc6c9829ec 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -282,6 +282,8 @@ Tests
 
 - Issue #19085: Added basic tests for all tkinter widget options.
 
+- Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.
+
 Documentation
 -------------