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.
ENH: Use tp_basicsize, not NPY_SIZEOF_PYARRAYOBJECT, for memory allocation.

This change allows C-API level subtypes of PyArray_Type without forcing the
developer to rewrite the tp_alloc function and only change the amount of
memory allocated.
BUG: PyArray_LexSort allocates too much temporary memory.

PyArray_LexSort was allocating memory to hold actual PyArrayObject's
and PyArrayIterObject's, but only storing pointers to such objects
in the array.
Merge pull request #2976 from bfroehle/memory_waste

BUG: PyArray_LexSort allocates too much temporary memory.
Merge pull request #2975 from bfroehle/tp_alloc

ENH: Use tp_basicsize, not NPY_SIZEOF_PYARRAYOBJECT, for allocation
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.
Merge pull request #2979 from charris/fix-nansum

BUG: Make nansum work with booleans.
Merge pull request #2974 from seberg/issue-427

Fix some large array sorts and memory error handling
TST: Issue #2806 added test forfromfile/tofile with large arrays
FIX: fixing handling tofile/fromfile for large arrays Issue #2806
implemented NumPyOS_fread that would standardise all fread calls as well
as NumPyOS_fwrite to unify the fwrites.

Also made multiarray/ctors.c and multiarray/convert.c to use these new
functions.

see discussion in issue #2806
Unified fread/fwrite limits for NumPyOS_fread and NumPyOS_fwrite