[New-bugs-announce] [issue2742] example code does not work

Mike MacFaden report at bugs.python.org
Fri May 2 20:57:59 CEST 2008


New submission from Mike MacFaden <mrm at vmware.com>:

the url 
  http://docs.python.org/lib/socket-example.html
gives an example that uses socket.getaddrinfo that has this code

   HOST=''
   ...
   for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
     socket.SOCK_STREAM, 0, socket.AI_PASSIVE)

but this fails on freebsd 6.1/python 2.5 as follows

> /usr/home/mrm/s2.py(30)<module>()
-> for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, 
socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
(Pdb) p HOST
''
(Pdb) n
gaierror: (8, 'hostname nor servname provided, or not known')
> /usr/home/mrm/s2.py(30)<module>()

but setting 
  HOST=None
works fine.

either this is a doc bug or a code bug, your pick.

----------
assignee: georg.brandl
components: Documentation
messages: 66103
nosy: georg.brandl, mrm
severity: normal
status: open
title: example code does not work
type: behavior
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2742>
__________________________________


More information about the New-bugs-announce mailing list