BUG: Make nansum work with booleans.

This broke when function_base._nannop tried to fill a boolean array with
integer zeros, raising a 'safe_casting' error. It looks like nanargmax and
nanargmin would also break, and were probably incorrect for booleans in any
case. The fix is not to use fill values for boolean and integer dtypes.
Previously that was only done for the integer dtypes.
BUG: gh-2969: Backport memory leak fix 80b3a34.
BUG: gh-2790, fix column scaling in polynomial package least squares.

The columns should be scaled using their 2-norm, but in the complex case
that was being incorrectly computed as the square root of the sum of the
squared elements rather than as the square root of the  sum of their squared
real and imaginary parts.
TST: Add Test for column scaling in the polynomial package fits.

The test uses the complex set of sample points [1, 1j, -1, -1j] whose
squared sum is exactly zero. This would fail before the column scaling
was fixed.
BUG: Fix dtypes in sorting functions to npy_intp

Some of the iteration variables were int, causing sorts to fail for large
arrays. Fixes github issue 427.
BUG: Fix reporting of memory error inside sorting

PyDataMem_NEW was not checked for error and the occurance of
errors not returned correctly in new_sort. Also for PyArray_LexSort
and new_argsort it should now raise MemoryError correctly.
This is done by setting PyErr_NoMemory() when no error is already
present, as the low level sorting can only fail for this reason.
BUG: Fix regression of bad error/random behavior in item method

Appearently .item() for arrays with size != 1 correctly returned an error
in 1.6., but failed to raise the error (due to missing return) in 1.7.
Merge pull request #2983 from charris/backport-fix-memory-leak

BUG: gh-2969: Backport memory leak fix 80b3a34.
Merge pull request #3007 from seberg/fix-empty-item-backport

Backport gh-3006
Merge pull request #2984 from charris/backport-fix-complex-polynomial-fit

Backport fix complex polynomial fit
Merge pull request #2982 from charris/backport-fix-nansum

BUG: Make nansum work with booleans.
Merge pull request #2985 from seberg/backport-large-sort-fixes

Backport large sort fixes
BUG: Incref items in np.take on error as they are decrefed later

When take fails during copying due to out of bound indices, then the already
copied items will be decref'd on array destruction. To avoid that, as well
as possible overlapping or already initialized object arrays, decref and
incref during the copy operation itself. Note that all basic types but
object use their own fasttake, so this does not change anything for them.

Also use new (conflicting) numpy/core/tests/test_item_selection.py with
small modifications.
TST: Add test for np.take refcounting

Also make the testcase for take a class.
BUG: non-empty takes on empty axes failed for clip/wrap logic

These did no checking for this special case. And thus, wrap would go
into infinite loops trying to adjust the index, and clip would (probably)
segfault. This raises IndexError explicitely beforehand.
Merge pull request #3039 from seberg/backport-object-take

Backport object take