Add support for dtype in arange

And a few test cases!
Support array indexing through an array for any numpy expression
Fix several memory leaks

When initializing an ndarray from a pointer, do not automatically set
the memory as foreign. Do it only if asked too, i.e. if the memory comes
from Python.