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
Merge pull request #3121 from charris/2to3-fix-for-in-f_dot_readlines

2to3: Remove xreadlines and replace f.readlines() by f where valid.
DOC: Fix typo in fft docs (the indexing variable is 'm', not 'n').
Merge pull request #3123 from maxalbert/master

Typo fix in FFT docs
BUG: fix issue with distutils.exec_command introduced in 1.7.0.

Closes gh-2999 and gh-2915.

There are several packages (nose, scipy.weave.inline, Sage inline Fortran) that
replace stdout, in which case it doesn't have a fileno method.  This method was
attempted to be used (change in gh-2766 to fix a py3k issue).
FIX: add _supports_fileno() for testing fileno()

The new _supports_fileno() function works in all versions of Python.
The problem was that in Python 2.x, the fileno() method of StringIO() is
missing, while in Python 3.x, it is present, but raises an exception.
PEP8: don't use \
DOC: Add mention of PyArray_SetBaseObject stealing a reference
Merge pull request #3130 from mwiebe/setbaseobj_doc

DOC: Add mention of PyArray_SetBaseObject stealing a reference
TST: add robust tests for exec_command()

First, we test both stdout and stderr.

Second, we now test both _exec_command_posix() and _exec_command(), see
numpy/distutils/exec_command.py. This reveals a bug in the implementation which
will be fixed in the next commit. For now the failing test is commented out so
that all tests still pass.
Implement separate checking for stdout and stderr

And enable a test for this that was failing before.
TST: Redirect the other stream to temp. file

Now things behave the same if executed with either of:

nosetests
nosetests -s
TST: skip general test on non-posix platforms

Add a comment explaining the issue.
Merge pull request #3128 from certik/pull-request-3127

BUG: fix issue with distutils.exec_command introduced in 1.7.0.
TST: open the TemporaryFile in ASCII mode

This should fix gh-3165.

Conflicts:
	numpy/distutils/tests/test_exec_command.py
Merge pull request #3167 from certik/forwardport3165

TST: open the TemporaryFile in ASCII mode
2to3: Replace xrange by range and use list(range(...)) where needed

In python3 range is an iterator and `xrange` has been removed. This has
two consequence for code:

    1) Where a list is needed `list(range(...))` must be used.
    2) `xrange` must be replaced by `range`

Both of these changes also work in python2 and this patch makes both.

There are three places fixed that do not need it, but I left them in
so that the result would be `xrange` clean.

Closes #3092