Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.

This commit is contained in:
Ned Deily 2014-02-13 22:50:42 -08:00
parent ffadbb7ee7
commit b24f481ab4
2 changed files with 10 additions and 2 deletions

View File

@ -1164,9 +1164,15 @@ class GeneralModuleTests(unittest.TestCase):
# Issue #6697. # Issue #6697.
self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800') self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800')
# Issue 17269 # Issue 17269: test workaround for OS X platform bug segfault
if hasattr(socket, 'AI_NUMERICSERV'): 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): def test_getnameinfo(self):
# only IP addresses are allowed # only IP addresses are allowed

View File

@ -116,6 +116,8 @@ Tests
- Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+. - 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 Documentation
------------- -------------