GalSim-developers/GalSim — pull request #373 by rmjarvis (2013-03-20 02:31:40+00:00)
Title: #298 Make wrapping work with numpy 1.7

I think I have everything working with numpy 1.7 now.

I have to say, now that I've gone through this that their API is complete crap. And it has only gotten worse with this new change. You basically have to `reinterpret_cast` everything back and forth between `PyObject*` and `PyArrayObject*`. And I'm sorry, but anything that requires that much use of `reinterpret_cast` as a matter of course just to do the really normal things you would want to use it for is extremely poor design.

Most of what I had to do was add even more explicit casts to make the arguments to various functions have the right type. They used to just work when everything was a `PyObject*` (although Jim already had a fair amount of casting going on with the old API), but now they give errors if you pass a `PyObject*` to most of the functions that want a `PyArrayObject*`, even though their API documentation says "The input argument, arr, can be any PyObject * that is directly interpretable as a PyArrayObject * (any instance of the PyArray_Type and its sub-types)." But apparently that's just bullshit.

Anyway, sorry for the rant. This is a pretty easy pull request. I've already tested it on systems that have numpy versions 1.2, 1.5, 1.6 and 1.7. So I think everything is copasetic. But give it a try to make sure it works on your system.