Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7bb675

Browse files
committed
Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.
2 parents 0714b8b + b24f481 commit b7bb675

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Lib/test/test_socket.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,9 +1234,15 @@ def testGetaddrinfo(self):
12341234
# Issue #6697.
12351235
self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800')
12361236

1237-
# Issue 17269
1237+
# Issue 17269: test workaround for OS X platform bug segfault
12381238
if hasattr(socket, 'AI_NUMERICSERV'):
1239-
socket.getaddrinfo("localhost", None, 0, 0, 0, socket.AI_NUMERICSERV)
1239+
try:
1240+
# The arguments here are undefined and the call may succeed
1241+
# or fail. All we care here is that it doesn't segfault.
1242+
socket.getaddrinfo("localhost", None, 0, 0, 0,
1243+
socket.AI_NUMERICSERV)
1244+
except socket.gaierror:
1245+
pass
12401246

12411247
def test_getnameinfo(self):
12421248
# only IP addresses are allowed

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ Library
3333
- Issue #19856: shutil.move() failed to move a directory to other directory
3434
on Windows if source name ends with os.altsep.
3535

36+
Tests
37+
-----
38+
39+
- Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust.
40+
3641

3742
What's New in Python 3.4.0 release candidate 1?
3843
===============================================

0 commit comments

Comments
 (0)