diff options
Diffstat (limited to 'Lib/lib2to3/main.py')
| -rw-r--r-- | Lib/lib2to3/main.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py index 6e09693..6c57e67 100644 --- a/Lib/lib2to3/main.py +++ b/Lib/lib2to3/main.py @@ -60,8 +60,14 @@ class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): else: self.log_message("Refactored %s", filename) if self.show_diffs: - for line in diff_texts(old, new, filename): - print(line) + diff_lines = diff_texts(old, new, filename) + try: + for line in diff_lines: + print(line) + except UnicodeEncodeError: + warn("couldn't encode %s's diff for your terminal" % + (filename,)) + return def warn(msg): print("WARNING: %s" % (msg,), file=sys.stderr) |
