Avoid overallocating memory in arraypad with user supplied function

Previously, arraypad used zeros(shape).astype(dtype) instead of
zeros(shape, dtype), which could allocate up to eight times more memory
than necessary.
Merge pull request #4128 from longjon/master

Avoid overallocating memory in arraypad with user supplied function