diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-03-05 12:09:12 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-03-05 13:31:39 -0700 |
commit | 342f074eb412e4cc19ab31a35a4ca04449e61597 (patch) | |
tree | 78c3e4656d6718c427ea9e9b578ad7f64330a82a /numpy/distutils/misc_util.py | |
parent | 9311fb7e861e2c8eb686abded01c059b49f0b5e4 (diff) | |
download | numpy-342f074eb412e4cc19ab31a35a4ca04449e61597.tar.gz |
2to3: Remove xreadlines and replace f.readlines() by f where valid.
An open file `f` has been an iterator since python2.3 and
`f.xreadlines()` is no longer needed, so replace it with `f`. Also
replace `f.readlines()` with `f` where an iterator will do. The
replacement of `f.readlines()` is not critical because it is a list in
both python2 and python3, but the code is a bit cleaner.
Closes #3093
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r-- | numpy/distutils/misc_util.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index c22aacb9a..556668264 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -167,7 +167,7 @@ def get_mathlibs(path=None): fid = open(config_file) mathlibs = [] s = '#define MATHLIB' - for line in fid.readlines(): + for line in fid: if line.startswith(s): value = line[len(s):].strip() if value: @@ -394,8 +394,7 @@ def _get_f90_modules(source): return [] modules = [] f = open(source,'r') - f_readlines = getattr(f,'xreadlines',f.readlines) - for line in f_readlines(): + for line in f: m = f90_module_name_match(line) if m: name = m.group('name') |