[PATCH] D68800: [LNT] Python 3 support: adapt csv reader open

Przemyslaw Wirkus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 07:52:54 PST 2019


PrzemekWirkus added inline comments.


================
Comment at: lnt/tests/nt.py:774-777
+    if sys.version_info[0] < 3:
+        report_file = open(report_path, 'rb')
+    else:
+        report_file = open(report_path, 'r', newline='')
----------------
PrzemekWirkus wrote:
> PrzemekWirkus wrote:
> > Can you verify that you should rather use mode == 'U' for universal mode?
> > 
> > https://docs.python.org/release/3.2/library/functions.html#open
> > 
> > See table below the Python 3 open function instead of newline == ''.
> > 
> > I'm not an expert in this area.
> I need to clarify:
> 
> I was wondering if we should combine mode == 'rU' with newline=='' or not.
My thinking is that when you use Universal mode "rU" you will get all newlines -> '\n'. Would that be enough you think?


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

https://reviews.llvm.org/D68800





More information about the llvm-commits mailing list