BUG FIX: cartesian_product now converts all arguments to ndarrays

Fixes GitHub issue #6439.