Merge pull request #2821 from ContinuumIO/ufunc-fancy-indexing3

in place fancy indexing for ufuncs
MAINT: Move NPY_BEGIN_THREADS_DEF to end of declarations.

The is an ';' at the end of the macro definition. When used and followed
by another ';', gcc thinks a statement has been made. An empty
statement, but still a statement. This causes compilation failure with
Python 3.4a.

The ';' should probably be removed, but that was undone in 1.7 to
maintain backward compatibility.
Merge pull request #3629 from charris/fix-out-of-order-declaration

MAINT: Move NPY_BEGIN_THREADS_DEF to end of declarations.
BUG: fix np.median so it accepts array_like input.  Clean up median tests.
Merge pull request #3628 from seberg/issue-3589

BUG: MapIter leaked itself and arr and index objects
Merge pull request #3630 from rgommers/fix-median

BUG: fix np.median so it accepts array_like input.  Clean up median test...
RF - allow ndarray.searchsorted to avoid making a copy for non-contiguous arrays
TST - add testing of searchsorted on unaligned arrays
BF - cast psorter pointer to intp
RF - have searchsorted copy haystack when the needle is bigger than the haystack
MAINT - update comments related to searchsorted to be consistent with code.
Merge pull request #3107 from MrBago/improve_searchsorted

Improve searchsorted
MAINT: Make setting mask values with scalars faster.

The current implementation assigns the mask value to a.flat, where a is
the mask being updated. In the scalar case, that is slower than
assigning to a[...], so when a is an instance of int, float, np.bool_,
or np.number use that instead.
Merge branch 'fast-mask'

* fast-mask:
  MAINT: Make setting mask values with scalars faster.
BUG: Fix reference leak in PyArray_IntpFromIndexSequence.

This caused {ones, zeros, empty}([1]*10) to increase the reference
count of 1 by 10. Same for other numbers in the list.

Closes #3589.
TST: Add test for reference leak in zeros, ones, empty, and full.

Check that the reference counts of the  passed dimensions do not
change.
MAINT: Remove some commented out code in test_indexing.py.

The code was intended to check refcounting, and indeed, exposed a long
standing bug by failing, which is why it was commented out. That bug is
now fixed and tested by gh-3631, so the commented out code could
theoretically be made to work, but that requires enough del this and del
the other that I think it is too fragile to keep. So delete it.
Merge pull request #3632 from charris/remove-commented-out-code

MAINT: Remove some commented out code in test_indexing.py.
Merge pull request #3631 from charris/fix-reference-leak

Fix reference leak
BUG: Fix PyBUF_SIMPLE flag to GetBuffer.

When no strides are requested, the array must be C-contiguous,
not only if a shape was also requested.

Closes gh-3613