summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-11 00:36:28 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-11 00:36:28 +0200
commit530712625bac0cb8b507746406163b66f2d36c49 (patch)
treebb239f54caca4a082e47a83cb73e408a9eb3e6ca /Lib/compileall.py
parentClose #10419, issue #6011: build_scripts command of distutils handles correctly (diff)
downloadcpython-530712625bac0cb8b507746406163b66f2d36c49.tar.gz
cpython-530712625bac0cb8b507746406163b66f2d36c49.tar.bz2
cpython-530712625bac0cb8b507746406163b66f2d36c49.zip
Issue #11169: compileall module uses repr() to format filenames and paths to
escape surrogate characters and show spaces.
Diffstat (limited to 'Lib/compileall.py')
-rw-r--r--Lib/compileall.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py
index d79a1bb9a09..743be276641 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -35,11 +35,11 @@ def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None,
optimize: optimization level or -1 for level of the interpreter
"""
if not quiet:
- print('Listing', dir, '...')
+ print('Listing {!r}...'.format(dir))
try:
names = os.listdir(dir)
except os.error:
- print("Can't list", dir)
+ print("Can't list {!r}".format(dir))
names = []
names.sort()
success = 1
@@ -109,13 +109,13 @@ def compile_file(fullname, ddir=None, force=False, rx=None, quiet=False,
except IOError:
pass
if not quiet:
- print('Compiling', fullname, '...')
+ print('Compiling {!r}...'.format(fullname))
try:
ok = py_compile.compile(fullname, cfile, dfile, True,
optimize=optimize)
except py_compile.PyCompileError as err:
if quiet:
- print('*** Error compiling', fullname, '...')
+ print('*** Error compiling {!r}...'.format(fullname))
else:
print('*** ', end='')
# escape non-printable characters in msg
@@ -126,7 +126,7 @@ def compile_file(fullname, ddir=None, force=False, rx=None, quiet=False,
success = 0
except (SyntaxError, UnicodeError, IOError) as e:
if quiet:
- print('*** Error compiling', fullname, '...')
+ print('*** Error compiling {!r}...'.format(fullname))
else:
print('*** ', end='')
print(e.__class__.__name__ + ':', e)