Issue #17222: fix a mix-up in some exception messages.
Reported by Arfrever Frehtes Taifersar Arahesis.
This commit is contained in:
parent
e08d4881f8
commit
9674bd0a94
|
@ -112,11 +112,11 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
|
||||||
if os.path.islink(cfile):
|
if os.path.islink(cfile):
|
||||||
msg = ('{} is a symlink and will be changed into a regular file if '
|
msg = ('{} is a symlink and will be changed into a regular file if '
|
||||||
'import writes a byte-compiled file to it')
|
'import writes a byte-compiled file to it')
|
||||||
raise FileExistsError(msg.format(file, cfile))
|
raise FileExistsError(msg.format(cfile))
|
||||||
elif os.path.exists(cfile) and not os.path.isfile(cfile):
|
elif os.path.exists(cfile) and not os.path.isfile(cfile):
|
||||||
msg = ('{} is a non-regular file and will be changed into a regular '
|
msg = ('{} is a non-regular file and will be changed into a regular '
|
||||||
'one if import writes a byte-compiled file to it')
|
'one if import writes a byte-compiled file to it')
|
||||||
raise FileExistsError(msg.format(file, cfile))
|
raise FileExistsError(msg.format(cfile))
|
||||||
loader = importlib.machinery.SourceFileLoader('<py_compile>', file)
|
loader = importlib.machinery.SourceFileLoader('<py_compile>', file)
|
||||||
source_bytes = loader.get_data(file)
|
source_bytes = loader.get_data(file)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue