[New-bugs-announce] [issue15617] FAIL: test_create_connection (test.test_socket.NetworkConnectionNoServer)

Floris Bruynooghe report at bugs.python.org
Fri Aug 10 15:00:52 CEST 2012

New submission from Floris Bruynooghe:

The SPARC Solaris 10 OpenCSW 3.x builder fails with

FAIL: test_create_connection (test.test_socket.NetworkConnectionNoServer)
Traceback (most recent call last):
  File "/export/home/buildbot/buildarea/3.x.bruynooghe-solaris-csw/build/Lib/test/test_socket.py", line 4101, in test_create_connection
    self.assertEqual(cm.exception.errno, errno.ECONNREFUSED)
AssertionError: 128 != 146


I think the issue here is that socket.create_connection iterates over the result of socket.getaddrinfo('localhost', port, 0, SOCK_STREAM) which returns [(2, 2, 0, '', ('', 0)), (26, 2, 0, '', ('::1', 0, 0, 0))] on this host.

The first result is tried and returns ECONNREFUSED but then the second address is tried and this returns ENETUNREACH because this host has not IPv6 network configured.  And create_connection() raises the last exception it received.

If getaddrinfo() is called with the AI_ADDRCONFIG flag then it will only return the IPv4 version of localhost.

components: Tests
messages: 167867
nosy: flub
priority: normal
severity: normal
status: open
title: FAIL: test_create_connection (test.test_socket.NetworkConnectionNoServer)
type: behavior
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list