summaryrefslogtreecommitdiffstats
path: root/Lib/compileall.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/compileall.py')
-rw-r--r--Lib/compileall.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py
index c3bf25a..eb5e24b 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -104,7 +104,10 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
print('*** Error compiling', fullname, '...')
else:
print('*** ', end='')
- print(err.msg)
+ # escape non-printable characters in msg
+ msg = err.msg.encode(sys.stdout.encoding, errors='backslashreplace')
+ msg = msg.decode(sys.stdout.encoding)
+ print(msg)
success = 0
except (SyntaxError, UnicodeError, IOError) as e:
if quiet: