Constify args where it makes sense.
Fix segfault when the result of a reshape is 0-d.  Also add that as a testcase in test_shape().