MAINT: change place where NPY_NO_DEPRECATED_API is defined in f2py.

This makes sure to undef at the end (as suggested in gh-5270 by @charris), and by putting the define in the C code ensures that the error message is understandable.