diff options
author | Mathieu Bridon <[email protected]> | 2018-08-17 21:32:17 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-08-22 08:41:01 -0700 |
commit | ff0ce31e2a9135c3fcc3243773c442bc48f46b53 (patch) | |
tree | d6458fa83e3728a3b237020387255a32befa91f6 /src/intel/tools | |
parent | fc708069f74063428e90595f494de6c79515f64e (diff) |
python: Disable universal newlines
We are testing the behaviour of a tool, for different input files, each
one using a different newline sequence. ('\n' on UNIX, '\r\n' on
Windows, …)
Unfortunately, when opening a file in text mode, Python 3 will by
default enable the "universal newlines" mode, which means it replaces
all the known newline sequences by '\n'.
This (usually useful) behaviour breaks the tests, which are specifically
trying to handle files with newline sequences different from '\n'.
Disabling the universal newlines mode fixes the tests.
However, to keep the script compatible with both Python 2 and 3, we must
use the io.open() function instead of the open() builtin, as the latter
only knows about the `newline` argument on Python 3.
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/intel/tools')
0 files changed, 0 insertions, 0 deletions