[PATCH] D68224: [LNT] Python 3 support: fix text/binary confusion in importreport

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 07:03:21 PDT 2019


thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D68223: [LNT] Python 3 support: fix convert to JSON.
thopre added a child revision: D68225: [LNT] Python 3 support: encode LNT report format in UTF-8.

lnt importreport currently fails in Python 3 because it opens the input
and output file in binary mode. Yet, as per documentation, this tools
converts "*text based* key value pairs into a LNT json report file".
The JSON file is output using the json module which expects a file
opened in text mode so this commit changes the mode of both the input
and output file to text.


https://reviews.llvm.org/D68224

Files:
  lnt/lnttool/import_report.py


Index: lnt/lnttool/import_report.py
===================================================================
--- lnt/lnttool/import_report.py
+++ lnt/lnttool/import_report.py
@@ -3,8 +3,8 @@
 
 @click.command("importreport", short_help="import simple space separated "
                "data into a report to submit.")
- at click.argument("input", type=click.File('rb'), default="-", required=False)
- at click.argument("output", type=click.File('wb'), default="report.json",
+ at click.argument("input", type=click.File('r'), default="-", required=False)
+ at click.argument("output", type=click.File('w'), default="report.json",
                 required=False)
 @click.option("--testsuite", "suite", default="nts", show_default=True,
               required=True, help="short name of the test suite to submit to")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68224.222420.patch
Type: text/x-patch
Size: 799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190930/2e78ad20/attachment.bin>


More information about the llvm-commits mailing list