diff --git a/datascience/util.py b/datascience/util.py index 67aca12b9..31abf864b 100644 --- a/datascience/util.py +++ b/datascience/util.py @@ -36,12 +36,15 @@ def make_array(*elements): >>> make_array("foo", "bar") array(['foo', 'bar'], dtype='>> make_array(True, False) + array([ True, False], dtype=bool) >>> make_array() array([], dtype=float64) """ - if elements and all(isinstance(item, (int, np.integer)) for item in elements): + if elements and all(isinstance(item, (int, np.integer)) and not isinstance(item, bool) for item in elements): # Specifically added for Windows machines where the default # integer is int32 - see GH issue #339. + # and ensures item is not bool, see issue #622. return np.array(elements, dtype="int64") # Manually cast `elements` as an object due to this: https://github.com/data-8/datascience/issues/458 diff --git a/tests/test_util.py b/tests/test_util.py index 95a68e3a8..dabde1e19 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -20,6 +20,8 @@ def test_make_array(): assert test3.dtype == "