Fix issue with empty arrays with numpy 1.2.1.

Snow Leopard and older use a version of numpy that has
a bug when reshaping empty arrays. The bug (and its fix)
is documented here: https://github.com/numpy/numpy/issues/2536

To overcome this numpy issue, we catch the exception and
explicitly create an empty array of the right shape instead
or reshaping the existing empty array.

Change-Id: Id89b377a66cc2b25371d6de9220963c44e0f1dbd
Merge topic 'fix_numpy_1.2.1' into master

4f3ffec5 Fix issue with empty arrays with numpy 1.2.1.