File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -827,14 +827,17 @@ def test_file(self):
827827 urls = [
828828 "file://localhost%s" % urlpath ,
829829 "file://%s" % urlpath ,
830- "file://%s%s" % (socket .gethostbyname ('localhost' ), urlpath ),
831830 ]
832- try :
833- localaddr = socket .gethostbyname (socket .gethostname ())
834- except socket .gaierror :
835- localaddr = ''
836- if localaddr :
837- urls .append ("file://%s%s" % (localaddr , urlpath ))
831+ if os .name != 'nt' :
832+ # On POSIX the local hostname may appear in a local file URL.
833+ # On Windows this would be decoded as a UNC path.
834+ urls .append ("file://%s%s" % (socket .gethostbyname ('localhost' ), urlpath ))
835+ try :
836+ localaddr = socket .gethostbyname (socket .gethostname ())
837+ except socket .gaierror :
838+ localaddr = ''
839+ if localaddr :
840+ urls .append ("file://%s%s" % (localaddr , urlpath ))
838841
839842 for url in urls :
840843 f = open (TESTFN , "wb" )
You can’t perform that action at this time.
0 commit comments