diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2010-03-16 13:19:21 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2010-03-16 13:19:21 (GMT) |
commit | 4b00307425bb3219f269a13ba5a9526903d21ce8 (patch) | |
tree | 8731e9ad5b15c88f637daad50f3b5bcc51ca1a07 /Lib/compileall.py | |
parent | 09c86afb1e3b2f1af8a03f77f2dd146429f56add (diff) | |
download | cpython-4b00307425bb3219f269a13ba5a9526903d21ce8.zip cpython-4b00307425bb3219f269a13ba5a9526903d21ce8.tar.gz cpython-4b00307425bb3219f269a13ba5a9526903d21ce8.tar.bz2 |
Issue #6716/2: Backslash-replace error output in compilall.
Diffstat (limited to 'Lib/compileall.py')
-rw-r--r-- | Lib/compileall.py | 5 |
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: |