From 4e571172a210612bdeba1db0135b7d5fbc44ee0c Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Wed, 28 Dec 2011 10:01:42 +0100 Subject: BUG: meshgrid: raise error on single input. --- numpy/lib/function_base.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index abb239ffc..8e2fc375e 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3288,13 +3288,14 @@ def meshgrid(*xi, **kwargs): """ copy_ = kwargs.get('copy', True) + + if len(xi) < 2: + msg = 'meshgrid() takes 2 or more arguments (%d given)' % int(len(xi) > 0) + raise ValueError(msg) + args = np.atleast_1d(*xi) ndim = len(args) - if ndim < 2: - msg = 'meshgrid() takes 2 or more arguments (%d given)' % int(ndim > 0) - raise TypeError(msg) - sparse = kwargs.get('sparse', False) indexing = kwargs.get('indexing', 'xy') -- cgit v1.2.1