Merged revisions 78991-78992,78994 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78991 | martin.v.loewis | 2010-03-16 12:03:13 +0100 (Di, 16 Mär 2010) | 9 lines

  Merged revisions 78976 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78976 | martin.v.loewis | 2010-03-15 14:00:17 +0100 (Mo, 15 Mär 2010) | 1 line

    Issue #6716: Quote -x arguments of compileall in MSI installer.
  ........
................
  r78992 | martin.v.loewis | 2010-03-16 14:19:21 +0100 (Di, 16 Mär 2010) | 2 lines

  Issue #6716/2: Backslash-replace error output in compilall.
................
  r78994 | martin.v.loewis | 2010-03-16 17:19:47 +0100 (Di, 16 Mär 2010) | 1 line

  Issue #6716/3: Exclude 2to3 tests from compileall.
................
diff --git a/Lib/compileall.py b/Lib/compileall.py
index 9451a60..2432842 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -77,7 +77,10 @@
                         print('*** Error compiling', fullname, '...')
                     else:
                         print('*** ', end='')
-                    print(err.msg)
+                    # escape non-printable characters in msg
+                    msg = err.msg.encode(sys.stdout.encoding, 'backslashreplace')
+                    msg = msg.decode(sys.stdout.encoding)
+                    print(msg)
                     success = 0
                 except (SyntaxError, UnicodeError, IOError) as e:
                     if quiet: