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.

classification
Title: socket module in 2.7.4 raises error instead of gaierror in 2.7.3
Type: Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: barry, benjamin.peterson, doko, pitrou
Priority: release blocker Keywords:

Created on 2013-03-30 12:26 by doko, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg185553 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-03-30 12:26
forwarded from https://launchpad.net/bugs/+bug/1154599

this seems to be changed behavior in 2.7.4. is it intended?

$ cat lookup.py 
#!/usr/bin/python
import sys, socket
names = ["slashdot.org", "foooooooooowhizzzzzzzz.com"]
if len(sys.argv) > 1:
   names = sys.argv[1:]
for iname in names:
    try:
        result = socket.getaddrinfo(iname, None, 0, 0, socket.SOCK_STREAM,
                                    socket.AI_CANONNAME)
        for (fam, stype, proto, cname, sockaddr) in result:
            sys.stdout.write("cname=%s, sockaddr=%s\n" % (cname, sockaddr))
    except socket.gaierror as error:
        sys.stderr.write("%s failed lookup" % iname)

$ python lookup.py # 2.7.3
cname=slashdot.org, sockaddr=('216.34.181.45', 0)
foooooooooowhizzzzzzzz.com failed lookup

$ python lookup.py # 2.7.4
cname=slashdot.org, sockaddr=('216.34.181.45', 0)
Traceback (most recent call last):
  File "lookup.py", line 9, in <module>
    socket.AI_CANONNAME)
socket.error: [Errno 2] No such file or directory
msg185559 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-03-30 14:14
Not really intended I think. Can you try to bisect to find out the responsible changeset?
msg185560 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-03-30 14:20
(by the way, I can't reproduce here)
msg185561 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-03-30 14:27
I can't reproduce it.

$ ./python lookup.py 
slashdot.org failed lookup
foooooooooowhizzzzzzzz.com failed lookup

Are you sure it's not some Ubuntu/Debian patch?
msg185853 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-04-02 18:27
Okay, so this is not a Python problem, but an Ubuntu problem.  It's also not a problem with Ubuntu's version of Python.  I can reproduce it on Ubuntu 13.04 with hg trunk, but not Debian Wheezy with hg trunk.

Closing as invalid and will investigate further in Ubuntu.
History
Date User Action Args
2022-04-11 14:57:43adminsetgithub: 61779
2013-04-02 18:27:47barrysetstatus: open -> closed
resolution: not a bug
messages: + msg185853
2013-03-30 14:40:36barrysetnosy: + barry
2013-03-30 14:27:37benjamin.petersonsetmessages: + msg185561
2013-03-30 14:20:41pitrousetmessages: + msg185560
2013-03-30 14:14:29pitrousetnosy: + pitrou
messages: + msg185559
2013-03-30 12:26:50dokocreate