mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-123599: url2pathname(): don't call gethostbyname() by default (#132610)
Follow-up to 66cdb2bd8a.
Add *resolve_host* keyword-only argument to `url2pathname()`, defaulting to
false. When set to true, we call `socket.gethostbyname()` to resolve the
URL hostname.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
This commit is contained in:
parent
082dbf7788
commit
8e08ac9f32
7 changed files with 48 additions and 30 deletions
|
|
@ -3290,7 +3290,6 @@ def test_from_uri_posix(self):
|
|||
self.assertEqual(P.from_uri('file:////foo/bar'), P('//foo/bar'))
|
||||
self.assertEqual(P.from_uri('file://localhost/foo/bar'), P('/foo/bar'))
|
||||
if not is_wasi:
|
||||
self.assertEqual(P.from_uri('file://127.0.0.1/foo/bar'), P('/foo/bar'))
|
||||
self.assertEqual(P.from_uri(f'file://{socket.gethostname()}/foo/bar'),
|
||||
P('/foo/bar'))
|
||||
self.assertRaises(ValueError, P.from_uri, 'foo/bar')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue