BUG: #4256: f2py, PyString_FromStringAndSize is undefined in Python3.

Use PyUString_FromStringAndSize defined in npy_3kcompat instead. Not
using bytes may cause some problems, but strings seem like a better
choice. As modules generated with current f2py error out, this
particular use is not common and we are free to choose.

Closes #4256.
BUG: #2408, Fix f2py Python 3 error message string bug.

The original was generating an exception message and, after aliasing,
calling PyBytes_AsString on a unicode string -> error. It was also
leaking references, although that probably didn't matter in context.

The fix here is on the cheap side, just use a C string for the message
without including the extra information about the erroneous type that
led to the exception.

No test, I don't know how to evoke this error.

Closes #2408.
Fix seterr example for resetting to old settings
Merge pull request #4305 from charris/fix-gh-4256

BUG: #4256: f2py, PyString_FromStringAndSize is undefined in Python3.
Merge pull request #4315 from charris/fix-gh-2408

BUG: #2408, Fix f2py Python 3 error message string bug.
TST: do not use "ignore" to filter warnings

When a warning is ignored (or raised once) in python, the warnings
module will tag on a `__warningregistry__` dictionary to be able
to filter these warnings in the future. This is tagged on to the
current context, causing leakage to later calls (this is a bit
more complex, since where the registry ends up depends on the
layers between the original caller and warner).

In short, tests should typically not use ignore but catch the
warnings to avoid changing the user experience (or errors
on duplicate test runs).

Fixes an error on duplicate test runs (does not remove all
"ignores" which may change behaviour outside tests).
Closes gh-4340
Merge pull request #4342 from seberg/issue-4340

TST: do not use "ignore" to filter warnings
BUG: Fixes #2799
Use `np.sort` instead of `sorted` when the input is a list and no indices
are requested. Fixes #2799.
ENH: add max fastpath to partition for nan detection

Allows low overhead check for NaN via isnan(partition(d, (x, -1))[-1])
BUG: handle non integer types for multinomial/dirichlet size

Closes gh-3173
MAINT: fix a bunch of compiler warnings
Merge pull request #4349 from juliantaylor/warning-maint

MAINT: fix a bunch of compiler warnings
Merge pull request #4347 from juliantaylor/partition-max

ENH: add max fastpath to partition for nan detection
Merge pull request #4344 from jaimefrio/unique-sort

BUG: Fixes #2799
Merge pull request #4288 from nh2/fix-seterr-examples

Mistake in seterr docs?
BUG: Whitespace stripping in pep3118 format parser and early free

Closes gh-3348
BUG: Hang on to originally filled Py_Buffer view.

When filling the python buffer view object, python sets
view.shape = &view.len (ndim=1, so this works). If we copy
the view info into our Memoryview object instead of having
it directly filled &view.len points into nirvana.

Closes gh-3175
Merge pull request #4350 from seberg/buffer-fixes

Buffer fixes
Merge pull request #4348 from juliantaylor/rand-int-check-bug

BUG: handle non integer types for multinomial/dirichlet size