[Python-checkins] cpython (2.7): Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.

ned.deily python-checkins at python.org
Fri Feb 14 07:54:42 CET 2014


http://hg.python.org/cpython/rev/6017d19669c3
changeset:   89188:6017d19669c3
branch:      2.7
user:        Ned Deily <nad at acm.org>
date:        Thu Feb 13 22:49:30 2014 -0800
summary:
  Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.

files:
  Lib/test/test_socket.py |  10 ++++++++--
  Misc/NEWS               |   2 ++
  2 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -663,9 +663,15 @@
         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.
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -282,6 +282,8 @@
 
 - Issue #19085: Added basic tests for all tkinter widget options.
 
+- Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.
+
 Documentation
 -------------
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list