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:
|
if source.getByteStream() is None:
|
||||||
sysid = source.getSystemId()
|
sysid = source.getSystemId()
|
||||||
if os.path.isfile(sysid):
|
basehead = os.path.split(os.path.normpath(base))[0]
|
||||||
basehead = os.path.split(os.path.normpath(base))[0]
|
sysidfilename = os.path.join(basehead, sysid)
|
||||||
source.setSystemId(os.path.join(basehead, sysid))
|
if os.path.isfile(sysidfilename):
|
||||||
f = open(sysid, "rb")
|
source.setSystemId(sysidfilename)
|
||||||
|
f = open(sysidfilename, "rb")
|
||||||
else:
|
else:
|
||||||
source.setSystemId(urlparse.urljoin(base, sysid))
|
source.setSystemId(urlparse.urljoin(base, sysid))
|
||||||
f = urllib.urlopen(source.getSystemId())
|
f = urllib.urlopen(source.getSystemId())
|
||||||
|
|
Loading…
Reference in New Issue