This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients Michael.Felt, asvetlov, eamanu, lepaperwan, maxifree, miss-islington, twisteroid ambassador, yselivanov
Date 2019-05-22.08:43:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
from below:

In case of 3.7 first call to _ensure_resolved returns
('fe80::1', 12345, 0, 1)
then second call returns
('fe80::1', 12345, 0, 0)
Notice that scope is now completely lost and is set to 0, thus actual call to socket.connect is wrong

In case of 3.6 both first and second call to _ensure_resolved return
('fe80::1%lo', 12345, 0, 1)
because in 3.6 case scope info is preserved in address and second call can derive correct address tuple

I'll have to locate the PR I made to resolve the test issue AIX was having - but it seems the address format ::1%lo is not supported everywhere. FYI: I do not believe the PR was backported into 3.6.

** Found it:
commit 413118ebf3162418639a5c4af14b02d26571a02c
Author: Michael Felt <>
Date:   Fri Sep 14 01:35:56 2018 +0200

    Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') (#8907)

[3.7] bpo-34490: Fix test_asyncio for AIX - do not call transport.get_extra_info('sockname') (GH-8907) #9286

Since in the first call - a scope of 1 is being returned - the initial "open" seems to be working as expected.

Some "help" to be sure I do exactly the same tests.

**** Reading through the bpo text, my change was only to skip the test because 
quote: On AIX with AF_UNIX family sockets getsockname() does not provide 'sockname'

and, from memory, the information being looked for is the bit after the '%' - aka scope.

On the one hand - the test is working - the information being returned does not match:

FAIL: test_create_connection_ipv6_scope (test.test_asyncio.test_base_events.BaseEventLoopWithSelectorTests)
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/", line 1226, in patched
    return func(*args, **keywargs)
  File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_asyncio/", line 1316, in test_create_connection_ipv6_scope
    sock.connect.assert_called_with(('fe80::1', 80, 0, 1))
  File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/", line 838, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: connect(('fe80::1', 80, 0, 1))
Actual: connect(('fe80::1', 80, 0, 0))

What is not clear from the test is that what "expected" says, is not the same as the first address in the code:

        coro = self.loop.create_connection(asyncio.Protocol, 'fe80::1%1', 80)
        t, p = self.loop.run_until_complete(coro)
            sock.connect.assert_called_with(('fe80::1', 80, 0, 1))
            _, kwargs = m_socket.socket.call_args
            self.assertEqual(kwargs['family'], m_socket.AF_INET6)
            self.assertEqual(kwargs['type'], m_socket.SOCK_STREAM)
            test_utils.run_briefly(self.loop)  # allow transport to close

'fe80::1%1' <> 'fe80::1' - and maybe, on AIX - the initial connection failed. (or maybe it has to have succeeded, or the failure message would look different). I am not 'experienced' with IPv6 and scope.
Date User Action Args
2019-05-22 08:43:49Michael.Feltsetrecipients: + Michael.Felt, asvetlov, yselivanov, lepaperwan, eamanu, twisteroid ambassador, miss-islington, maxifree
2019-05-22 08:43:49Michael.Feltsetmessageid: <>
2019-05-22 08:43:49Michael.Feltlinkissue35545 messages
2019-05-22 08:43:49Michael.Feltcreate