Skip to content

Commit d0491cd

Browse files
authored
[3.7] bpo-34490: Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') (GH-8907) (#9286)
* [3.7] Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') (GH-8907). (cherry picked from commit 413118e) Co-authored-by: Michael Felt <[email protected]> * Update test_events.py
1 parent 2b16294 commit d0491cd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Lib/test/test_asyncio/test_events.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
from test import support
3838

3939

40-
def osx_tiger():
40+
def broken_unix_getsockname():
4141
"""Return True if the platform is Mac OS 10.4 or older."""
42-
if sys.platform != 'darwin':
42+
if sys.platform.startswith("aix"):
43+
return True
44+
elif sys.platform != 'darwin':
4345
return False
4446
version = platform.mac_ver()[0]
4547
version = tuple(map(int, version.split('.')))
@@ -613,7 +615,7 @@ def test_create_connection(self):
613615
def test_create_unix_connection(self):
614616
# Issue #20682: On Mac OS X Tiger, getsockname() returns a
615617
# zero-length address for UNIX socket.
616-
check_sockname = not osx_tiger()
618+
check_sockname = not broken_unix_getsockname()
617619

618620
with test_utils.run_test_unix_server() as httpd:
619621
conn_fut = self.loop.create_unix_connection(
@@ -744,7 +746,7 @@ def test_create_ssl_connection(self):
744746
def test_create_ssl_unix_connection(self):
745747
# Issue #20682: On Mac OS X Tiger, getsockname() returns a
746748
# zero-length address for UNIX socket.
747-
check_sockname = not osx_tiger()
749+
check_sockname = not broken_unix_getsockname()
748750

749751
with test_utils.run_test_unix_server(use_ssl=True) as httpd:
750752
create_connection = functools.partial(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
On AIX with AF_UNIX family sockets getsockname() does not provide 'sockname',
2+
so skip calls to transport.get_extra_info('sockname')

0 commit comments

Comments
 (0)