BUG: fix hashing of long integers under python3

python3 long_hash is more complex than int_hash so instead of copying
into numpy call it via the Python capi.
Same for long long for wich the numpy hash function is not correct with
python 2.7 on i386.
Will be slower but doesn't need adapting each timy python changes.
closes #3793
Merge pull request #3808 from charris/backport-1.7-3800

Backport 1.7 3800
[fix] Check for errors in PyArray_CanCastTypeto DEPRECATE

If a user had set warnings to raise errors, then this DEPRECATE would
leave us with an unpropagated exception and cause havoc downstream.

Unfortunately there is no way to propagate an exception from here, so
we just have to throw it away :-(. But this is still better than the
alternative...

Conflicts:
	numpy/core/tests/test_ufunc.py
[fix] If we fail to raise an error, at least dump something to the console

Conflicts:
	numpy/core/tests/test_ufunc.py
BUG: Do not use python with statement.

The python with statement is not available in Python 2.4, 2.5.
MAINT: Get rid of a Python 3 resource warning.
Merge pull request #3813 from charris/backport-1.7-3806

Backport 1.7 3806
Merge pull request #3815 from charris/backport-1.7-resourcewarning-fix

Backport 1.7 resourcewarning fix