mirror of https://github.com/python/cpython
SF bug #902037: relative on-disk SYSTEM id handling is incorrect
(Contributed by Bob Ippolito.) backport candidate.
This commit is contained in:
parent
e54e726f0b
commit
06d9b1f30b
|
@ -283,10 +283,11 @@ def prepare_input_source(source, base = ""):
|
|||
|
||||
if source.getByteStream() is None:
|
||||
sysid = source.getSystemId()
|
||||
if os.path.isfile(sysid):
|
||||
basehead = os.path.split(os.path.normpath(base))[0]
|
||||
source.setSystemId(os.path.join(basehead, sysid))
|
||||
f = open(sysid, "rb")
|
||||
sysidfilename = os.path.join(basehead, sysid)
|
||||
if os.path.isfile(sysidfilename):
|
||||
source.setSystemId(sysidfilename)
|
||||
f = open(sysidfilename, "rb")
|
||||
else:
|
||||
source.setSystemId(urlparse.urljoin(base, sysid))
|
||||
f = urllib.urlopen(source.getSystemId())
|
||||
|
|
Loading…
Reference in New Issue