csv.reader have different expectation between Python versions regarding
the file object it reads from. On Python 2 it requires the file to have
been opened in binary mode while on Python 3 it requires text mode and
universal newlines mode enabled but forwarded untranslated to the
caller. This commit use an if to cater to both requirements.
Details
Diff Detail
- Build Status
Buildable 39333 Build 39349: arc lint + arc unit
Event Timeline
lnt/tests/nt.py | ||
---|---|---|
774–777 | 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. |
lnt/tests/nt.py | ||
---|---|---|
774–777 | I need to clarify: I was wondering if we should combine mode == 'rU' with newline=='' or not. |
lnt/tests/nt.py | ||
---|---|---|
774–777 | My thinking is that when you use Universal mode "rU" you will get all newlines -> '\n'. Would that be enough you think? |
lnt/tests/nt.py | ||
---|---|---|
774–777 | It works on my testing but I'm not too keen on using rU since the doc you linked says specifically it's for compatibility and should not be used in new code. My goal in this Python 3 conversion is to follow the Python 3 codestyle/idioms. |
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.