From 3856a73ec59d9dcf8252a2d38b43191eacacbd2e Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Oct 2017 20:41:39 -0700 Subject: BUG: count_nonzero treats empty axis tuples strangely Fixes #9728 This bug was introduced with the `axis` keyword in #7177, as a misguided optimization. --- numpy/core/numeric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 6d29785da..1f8f5d43e 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -406,7 +406,7 @@ def count_nonzero(a, axis=None): array([2, 3]) """ - if axis is None or (isinstance(axis, tuple) and axis == ()): + if axis is None: return multiarray.count_nonzero(a) a = asanyarray(a) -- cgit v1.2.1