[PATCH] D68664: [lit] Clean up internal diff's encoding handling

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 14:24:29 PDT 2019


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm

I'm guessing you've tested with Python 2.7 and 3.5, and that's probably what matters.

Thanks for working on this, and sorry for ever expanding scope of the suggested refactorings.



================
Comment at: llvm/utils/lit/lit/builtin_commands/diff.py:36
+                                   locale.getpreferredencoding(False))
+    except UnicodeDecodeError:
+        try:
----------------
try / except UnicodeDecodeError is an exciting code pattern, but I guess it's the existing behavior. :)


================
Comment at: llvm/utils/lit/lit/builtin_commands/diff.py:43
+def compareTwoBinaryFiles(flags, filepaths, filelines):
+    #sys.stderr.write("Trying as binary....\n")
     exitCode = 0
----------------
Extra logging?


================
Comment at: llvm/utils/lit/lit/builtin_commands/diff.py:63
+def compareTwoTextFiles(flags, filepaths, filelines_bin, encoding):
+    #sys.stderr.write("Trying with encoding {}....\n".format(encoding))
     filelines = []
----------------
Ditto


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68664/new/

https://reviews.llvm.org/D68664





More information about the llvm-commits mailing list