Commit 9674bd0a authored by Brett Cannon's avatar Brett Cannon

Issue #17222: fix a mix-up in some exception messages.

Reported by Arfrever Frehtes Taifersar Arahesis.
parent e08d4881
......@@ -112,11 +112,11 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
if os.path.islink(cfile):
msg = ('{} is a symlink and will be changed into a regular file if '
'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):
msg = ('{} is a non-regular file and will be changed into a regular '
'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)
source_bytes = loader.get_data(file)
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment