Skip to content

Commit af17cc1

Browse files
authored
Merge pull request numpy#26883 from charris/fix-26879
BUG: Make issctype always return bool.
2 parents d0a328c + 58684de commit af17cc1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

numpy/_core/numerictypes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,13 @@ def issctype(rep):
223223
return False
224224
try:
225225
res = obj2sctype(rep)
226+
if res and res != object_:
227+
return True
228+
else:
229+
return False
226230
except Exception:
227231
return False
228-
else:
229-
return res and res != object_
232+
230233

231234
@set_module('numpy')
232235
def obj2sctype(rep, default=None):

numpy/_core/tests/test_numerictypes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ def test_issctype(rep, expected):
570570
# ensure proper identification of scalar
571571
# data-types by issctype()
572572
actual = issctype(rep)
573+
assert type(actual) is bool
573574
assert_equal(actual, expected)
574575

575576

0 commit comments

Comments
 (0)