summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/lib/polynomial.py4
-rw-r--r--numpy/lib/tests/test_polynomial.py6
2 files changed, 8 insertions, 2 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index e953f71ba..002b2859a 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -120,9 +120,9 @@ def poly(seq_of_zeros):
"""
seq_of_zeros = atleast_1d(seq_of_zeros)
sh = seq_of_zeros.shape
- if len(sh) == 2 and sh[0] == sh[1]:
+ if len(sh) == 2 and sh[0] == sh[1] and sh[0] != 0:
seq_of_zeros = eigvals(seq_of_zeros)
- elif len(sh) ==1:
+ elif len(sh) == 1:
pass
else:
raise ValueError, "input must be 1d or square 2d array."
diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py
index 85fc18933..bbc3b947e 100644
--- a/numpy/lib/tests/test_polynomial.py
+++ b/numpy/lib/tests/test_polynomial.py
@@ -143,5 +143,11 @@ class TestDocs(TestCase):
p2 = p.integ(3, k=[9,7,6])
assert (p2.coeffs == [1/4./5.,1/3./4.,1/2./3.,9/1./2.,7,6]).all()
+ def test_zero_dims(self):
+ try:
+ np.poly(np.zeros((0, 0)))
+ except ValueError:
+ pass
+
if __name__ == "__main__":
run_module_suite()