[issue13104] urllib.request.thishost() returns a garbage value

Deokhwan Kim report at bugs.python.org
Wed Oct 5 01:02:51 CEST 2011


New submission from Deokhwan Kim <dkim at csail.mit.edu>:

There is a minor typo in Lib/urllib/request.py:thishost(). Because of it, the thishost() function is returning a garbage value:

  >>> import urllib.request
  >>> urllib.request.thishost()
  ('XXXXXXX.XXXXX.XXX.com', ['X.XXXXX.XXX.com'], ['123.45.67.89'])

It is expected to return the IP addresses of the current host, so the correct return value would be like:

  >>> urllib.request.thishost.__doc__
  'Return the IP addresses of the current host.'
  >>> urllib.request.thishost()
  ('127.0.0.1', '127.0.1.1')

The attached patch will fix the mistake .

----------
components: Library (Lib)
files: thishost.patch
keywords: patch
messages: 144929
nosy: dkim
priority: normal
severity: normal
status: open
title: urllib.request.thishost() returns a garbage value
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file23316/thishost.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13104>
_______________________________________


More information about the Python-bugs-list mailing list