actually its no bug in numpy just a subtle optimization, ap1 takes ownership of dtype here.
so you could do the same by replacing all following `dtype` references with `PyArray_DESCR(ap2)` but this needs to be documented as a comment here.
this saves the dtype decref in the success fail path of the function.