mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
merge from 3.2. Issue13104 - Fix urllib.request.thishost() utility function.
This commit is contained in:
commit
55a190fbbd
2 changed files with 5 additions and 1 deletions
|
|
@ -1058,6 +1058,10 @@ class Utility_Tests(unittest.TestCase):
|
||||||
self.assertEqual(('user', 'a\vb'),urllib.parse.splitpasswd('user:a\vb'))
|
self.assertEqual(('user', 'a\vb'),urllib.parse.splitpasswd('user:a\vb'))
|
||||||
self.assertEqual(('user', 'a:b'),urllib.parse.splitpasswd('user:a:b'))
|
self.assertEqual(('user', 'a:b'),urllib.parse.splitpasswd('user:a:b'))
|
||||||
|
|
||||||
|
def test_thishost(self):
|
||||||
|
"""Test the urllib.request.thishost utility function returns a tuple"""
|
||||||
|
self.assertIsInstance(urllib.request.thishost(), tuple)
|
||||||
|
|
||||||
|
|
||||||
class URLopener_Tests(unittest.TestCase):
|
class URLopener_Tests(unittest.TestCase):
|
||||||
"""Testcase to test the open method of URLopener class."""
|
"""Testcase to test the open method of URLopener class."""
|
||||||
|
|
|
||||||
|
|
@ -2125,7 +2125,7 @@ def thishost():
|
||||||
"""Return the IP addresses of the current host."""
|
"""Return the IP addresses of the current host."""
|
||||||
global _thishost
|
global _thishost
|
||||||
if _thishost is None:
|
if _thishost is None:
|
||||||
_thishost = tuple(socket.gethostbyname_ex(socket.gethostname()[2]))
|
_thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
|
||||||
return _thishost
|
return _thishost
|
||||||
|
|
||||||
_ftperrors = None
|
_ftperrors = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue