I've made a PR against this one that avoids the second copy unless it really is non-contiguous (as you suggested above, I just implemented it)...